Memcache common methods
Memcache::add — Add a value, if it already exists, return false
Memcache::addServer — Add a server address for use
Memcache::close — Close a Memcache object
Memcache::connect — Create a Memcache object
Memcache::debug — Control the debugging function
Memcache::decrement — Subtract the value in a saved key
Memcache::delete — Delete a key value
Memcache::flush — Clear all caches Data
Memcache::get — Get a key value
Memcache::getExtendedStats — Get the running system statistics of all processes in the process pool
Memcache::getServerStatus — Get the parameters of the running server
Memcache::getStats — Return some operations of the server Statistics
Memcache::getVersion — Returns the version information of the running Memcache
Memcache::increment — Adds the value in a saved key
Memcache::pconnect — Creates a Memcache persistent connection object
Memcache:: replace — R overwrites an existing key
Memcache::set — Adds a value, and if it already exists, overwrites it
Memcache::setCompressThreshold — Compresses data larger than a certain size
Memcache::setServerParams — Modify the parameters of the server at runtime
Memcache method uses
to copy the code The code is as follows:
$memcache = new memcache;
$memcache->connect('127.0.0.1' , 11211) or die("Connection failed");
$memcache->set('name', 'Zhang San');
$val = $memcache->get('name');
?>
Copy the code The code is as follows:
$memcache = new memcache;
$memcache -> connect('127.0.0.1', 11211) or die("Connection failed");
$memcache -> set('name', array('one','two'));
$val = $memcache->get('name');
print_r($val);
$memcache -> close();
?>
The above introduces memcache PHP MemCached advanced caching application code, including memcache content. I hope it will be helpful to friends who are interested in PHP tutorials.