PHP two memcached extensions: Memcache and memcached, which is good for development

Source: Internet
Author: User
have been using Memcache class, incredibly found there are memcached this class
Memcache extension
memcached extension

$mem = new memcache();// $mem = new memcached();

Reply content:

have been using Memcache class, incredibly found there are memcached this class
Memcache extension
memcached extension

$mem = new memcache();// $mem = new memcached();

The actual project will determine at the PHP code level which extension the operating environment has to call which
Most of the development environment is win, just use Memcache
Build environment mostly Linux, just use memcached

    if (extension_loaded('memcached')) {        $this->cache = new \Memcached;     }else if(extension_loaded ('memcache'))        $this->cache = new \Memcache;      else{        $this->active = false;        Log::error('Cache not support!');        return false;    }

cc:http://segmentfault.com/q/1010000000513661

Memcached is a popular choice that works with many languages, including PHP.

However, to access a Memcached server from a PHP script, you have two different and named Stupid client library selections: Memcache and Memcached. They are two different libraries with almost identical names, both of which can be used to access a Memcached instance.

It turns out that the Memcached library has the best implementation of the Memcached protocol, contains some useful features that the Mmecache library does not have, and looks like the development of the Memcached library is also the most active.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.