1. Most PHP environments currently use memcache versions with no D, this version is earlier and is a native version, developed entirely within the PHP framework. The corresponding memcached with D is built on the basis of libmemcached, so the memcached version is relatively functional.
memcache:http://cn2.php.net/manual/en/book.memcache.php
memcached:http://cn2.php.net/manual/en/book.memcached.php
2.Memcache is a native implementation, supporting OO and non-oo two sets of interfaces coexist. The memcached is using libmemcached, which only supports OO interfaces.
The 3.memcached also has a very good place, that is, flag is not set at the time of operation, but with a unified setoption (). The memcached implements more memcached protocols.
The 4.memcached supports binary Protocol, while Memcache is not supported. This means that the memcached will have higher performance. However, Memcached currently does not support long connections.
Here is a table to compare PHP client extensions memcache and memcached
Http://code.google.com/p/memcached/wiki/PHPClientComparison
Another point is that people are more concerned about, that is, the algorithm used. As we all know, "consistent hash algorithm" is an algorithm that has less impact on data stored on memcached when a storage node is added or deleted. The algorithm can be used in PHP's two extension libraries, except that the Setup method is different.
Memcache
Modify PHP.ini Add:
[Memcache]
Memcache.allow_failover = 1
......
......
Memcache.hash_strategy =consistent
Memcache.hash_function =CRC32
......
......
Or use the Ini_set method in PHP:
Ini_set (' memcache.hash_strategy ', ' standard ');
Ini_set (' memcache.hash_function ', ' crc32 ');
Memcached
$mem = new memcached ();
$mem->setoption (memcached::opt_distribution,memcached::D istribution_consistent);
$mem->setoption (memcached::opt_libketama_compatible,true);
Reprinted from: http://www.jb51.net/article/27366.htm
The difference between memcache extension and memcached extension in PHP