Memcache PHP MemCached Advanced Cache app Code

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.