memcached Socket-based access Memcache cache server Operations Memcache commonly used three ways:1. Memcache based on Php_memcache.dll extension (php extension)2. memcached based on Php_memcached.dll extension (php extension)3. memcached socket-based access (network-based) memcached-The client.php call is simple and calls the following method:<?PHPHeader"content-type:text/html; Charset=utf-8"); //contains the Memcached class fileRequire_once ("memcached-client.php"); $options =Array ( 'Servers'= = Array ('127.0.0.1:11211'),//memcached service address, port, multiple array elements can be used to represent multiple memcached services 'Debug'=false,//whether to turn on debug 'Compress_threshold'=10240,//compression when more than a few bytes of data 'persistant'=false //whether to use persistent connections ); $MC =Newmemcached ($options); //sets the unique identifier used by this script$key ='a'; //writing objects to the memcached$MC->add ($key,'This is the key content'); /*deleting objects in memcached*/ $MC->delete ($key); /*Replace the contents of the identifier Key object*/ $MC->replace ($key, "This is the new content");$val = $MCGet($key);echo $val;?>
Memcached socket-based access to memcache cache server