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 — perform a subtraction operation on the value in a saved key
Memcache::delete — Delete a key value
Memcache::flush — Clear all cached data
Memcache::get — Get a key value
Memcache::getExtendedStats — Get all processes in the process pool Running system statistics
Memcache::getServerStatus — Get the parameters of the running server
Memcache::getStats — Return some running statistics of the server
Memcache::getVersion — Return the version information of the running Memcache
Memcache::increment — Add the value in a saved key
Memcache::pconnect — Create a Memcache persistent connection object
Memcache::replace — R overwrites an existing key Operations
Memcache::set — Add a value, or overwrite if it already exists
Memcache::setCompressThreshold — Compress data larger than a certain size
Memcache::setServerParams — Modify the server at runtime Parameters
Memcache method usage
<?php $memcache = new memcache; $memcache->connect('127.0.0.1', 11211) or die("连接失败"); $memcache->set('name', '张三'); $val = $memcache->get('name'); ?>
Note: The complete version of the set method, set (key name, key value, whether to compress, retention time)
<?php $memcache = new memcache; $memcache -> connect('127.0.0.1', 11211) or die("连接失败"); $memcache -> set('name', array('一个','两个')); $val = $memcache->get('name'); print_r($val); $memcache -> close(); ?>
More PHP For articles related to MemCached advanced caching application code, please pay attention to the PHP Chinese website!