What is memcache?
memcached is a software developed by Brad Fitzpatric of Danga Interactive, a subsidiary of LiveJournal. Now it has become an important factor in improving the scalability of Web applications in many services such as mixi, hatena, Facebook, Vox, LiveJournal and so on. Many web applications save data to an RDBMS, from which the application server reads the data and displays it in the browser.
However, as the amount of data increases and access becomes concentrated, there will be significant impacts such as increased burden on the RDBMS, deterioration of database response, and website display delays. This is where memcached comes into play. memcached is a high-performance distributed memory cache server. The general purpose of use is to increase the speed and scalability of dynamic web applications by caching database query results and reducing the number of database accesses.
Principle of combining memcached with php
##memcache cache data format
memcache uses Data is saved in the form of key-value pairs. By combining it with PHP, memcahe can save variables, arrays, objects and other data into memory. Greatly improves the efficiency of server caching. In order to improve performance, the data saved in memcached is stored in memcached's built-in memory storage space. Since data only exists in memory, restarting memcached and restarting the operating system will cause all data to disappear. In addition, after the content capacity reaches the specified value, unused caches are automatically deleted based on the LRU (Least Recently Used) algorithm. Memcached itself is a server designed for caching, so it does not consider the persistence of data too much. Related recommendations: "memcached tutorial"
The above is the detailed content of What is memcache?. For more information, please follow other related articles on the PHP Chinese website!