This article mainly introduces the PHP memcache, starting from the memcache introduction, in detail, such as memcache and memcached differences, PHP memcache all the operation methods, each operation method of the detailed explanation, the need for
1. What is memcache and what is memcache?
Memcache is a high-performance distributed memory object cache system. By maintaining a unified and huge hash table in the memory, memcache can be used to store data in various formats, including image,
Transferred from www.5iphp.com
The memcache function library is used in the PECL (PhP extension Community Library) to build a temporary storage area for large-capacity memory data. Its role is evident in distributed systems, otherwise, it is not
If you have more than one memcached server side, it is best to use memcache::addserver () to connect the service Frontend. instead of Memcache::connect () to connect to the memcached server, the PHP client uses the server pool to assign keys to
Memcached software download and installation tutorial1. Download the memcached compressed package, which contains 32-bit and 64-bit versions. Select the corresponding version of your system. Decompress the package to a disk, for example, in the D:
3.3 Design and Implementation of Server Load balancer
Sunny software company undertakes the development of a server load balance software, which runs on a server Load balancer server, concurrent access and data traffic can be distributed to
Usage:
Memcached
$ Cache = new cache_memcache ();$ Cache-> addserver ('www1 ');$ Cache-> addserver ('www2 ', expires 11,20); // This server has double the memory, and gets double the weight$ Cache-> addserver ('www3', 11211 );// Store some data
Usage:
Memcached
CopyCode The Code is as follows: $ cache = new cache_memcache ();
$ Cache-> addserver ('www1 ');
$ Cache-> addserver ('www2 ', expires 11,20); // This server has double the memory, and gets double the weight
$ Cache-> addserver
How to use:
Memcached
Copy the Code code as follows:
$cache = new Cache_memcache ();$cache->addserver (' www1 ');$cache->addserver (' www2 ', 11211,20); This server has double the memory, and gets double the weight$cache->addserver (' www3 ', 11211)
PHP memcached and Ttserver
Previously just use memcached do brush control, recently read some blog articles and some of the company's projects to deepen their understanding of a step, write a note.
?
PHP provides Memcache and Memcached, as for
A memcache usually does not meet our requirements, which requires a distributed deployment. memcached distributed deployment scenarios usually take two approaches, one is the normal hash distribution, the other is the consistent hash distribution.
1.memcache::add usagecode :bool Memcache::add (string $key, mixed $var [, int $flag [, int $expire]])Description :If $key does not exist, use this function to store the value of $var. Functions with the same function are Memcache_add ().Parameters :$
A memcache usually does not meet our requirements, which requires distributed deployment. memcached distributed deployment scenarios usually take two approaches, one is the normal hash distribution, the other is the consistent hash distribution.
PHP operations on memcache and phpmemcache* In the [1] Directory, install [2] connect to [3] add, delete, modify, and Query [4] distributed [5] status [6] Security [7] before the application
Similar to accessing the mysql server, PHP accesses the
Usage:MemcachedCopy codeThe Code is as follows:$ Cache = new Cache_MemCache ();$ Cache-> addServer ('www1 ');$ Cache-> addServer ('www2 ', expires 11,20); // this server has double the memory, and gets double the weight$ Cache-> addServer ('www3', 11
In PHP, Memcached and ttserver used to use memcached for anti-brush control. recently I read some blog articles and some company projects to learn more about it and take notes .? PHP provides memcache and memcached. for their differences, we
PHP memcached and Ttserver
Previously just use memcached do brush control, recently read some blog articles and some of the company's projects to deepen their understanding of a step, write a note.
?
PHP provides Memcache and Memcached, as for
The Memcache function library is in PECL (PHPExtensionCommunityLibrary). It is mainly used to set up a temporary storage area for large-capacity memory data. its function is obvious in distributed mode, otherwise it is not recommended to use it.
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.