Use of memcache, memcache use
What is Memcache?
Memcache is a high-performance distributed memory object caching system that can be used to store data in a variety of formats, including images, videos, files, and database retrieval results, by maintaining a unified, huge hash table in memory. The simple thing is to call the data into memory and read it from memory, which can greatly improve the reading speed (from 36,000 section)
It is equivalent to a memory database that can reduce operations on the database.
It was initially seen in a PHP interface server in the company.
Installation:
How to install in Ubuntu: Digging pits (the next time you fill in the procedure forgot)
Apt-get Install memcached
After installation.
sudo memcached start start
/ETC/MEMCACHED.CONF is the default configuration file
-P Listening Port
-L connected IP address, default is native
-D Start memcached service
-D Restart Restart memcached service
-D Stop|shutdown Close the running memcached service
-D Install memcached service
-d Uninstall Uninstall memcached service
-U Run as (only valid when running as root)
-m maximum memory usage, in megabytes. Default 64MB
-M running out of memory and returning an error instead of deleting an item
-c Maximum number of simultaneous connections, default is 1024
-F Block size growth factor, default is 1.25-n minimum allocation space, key+value+flags default is 48
-h Display Help 2) Installing the Memcache client
PHP memcache Module Installation Method:
sudo apt-get install Php5-memcache
How to use: PHP manual with the use of the module instructions
Python: module Download address https://pypi.python.org/pypi/python-memcached
Import Memcache mc = Memcache. Client ([' 127.0.0.1:11211 ']) mc.set (' Hello ', ' World ') mc.get (' Hello ')
Some notes:
Memcached does not have a security certificate, so if the configured-L listening IP is local to the IP may cause data security issues
Later with the familiar again pits
CI memcache How to use configuration
CI is Memcacehd you installed memcache a "D" character, the difference is very big. CI only supports memcached and does not support memcache. Only memcache under Windows.
How to use the Memcache cache rationally? If the amount of cache data is too large how to deploy?
Memcache server, to special configuration, memory is large, other hardware can be used
Other solutions: You can configure the distributed cache
Because Memcache is generally used only for LAN
Works by: The Web server uses the Memcache cache and then caches the data on the Memcache server, Memecache only memory
Too much data can only increase servers, deploy distributed cache
Others can be contacted again
http://www.bkjia.com/PHPjc/893203.html www.bkjia.com true http://www.bkjia.com/PHPjc/893203.html techarticle memcache Use, memcache use what is Memcache? Memcache is a high-performance distributed memory object caching system that maintains a unified huge hash table in memory, it ...