Memcache Common methods
Memcache::add-adds a value that returns false if it already exists
memcache::addserver-Add a server address that is available for use
memcache::close-Close a Memcache object
memcache::connect-Creating a Memcache Object
Memcache::d ebug-control Debugging function
Memcache::d ecrement-to subtract a value from a saved key
Memcache::d elete-Delete a key value
memcache::flush-to clear all cached data
memcache::get-get a key value
memcache::getextendedstats-get run System statistics for all processes in the process pool
memcache::getserverstatus-getting parameters to run the server
memcache::getstats-returns some running statistics for the server
memcache::getversion-returns the version information of the running Memcache
memcache::increment-an addition to the value in a saved key
Memcache: Create a Memcache Persistent connection object:p connect-
Memcache::replace-r Overwrite an existing key
Memcache::set-adds a value that, if already present, overwrite
memcache::setcompressthreshold-compression of data larger than a certain size
memcache::setserverparams-modifying the server's parameters at run time
The Memcache method uses
Copy the Code code 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 ');
?>
Note: The full version of the Set method, set (key name, key value, whether compressed, hold time)
Copy the Code code 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 describes the Memcache PHP MemCached Advanced Cache application code, including the memcache aspect of the content, I hope to be interested in PHP tutorial friends helpful.