Home >Backend Development >PHP Tutorial >PHP MemCached advanced cache configuration graphic tutorial_PHP tutorial
1. Introduction to Memcache
Memcache is a high-performance distributed memory object cache system that can be used to store data in various formats, including images, videos, files and databases Search results, etc.
Websites that use Memcache generally have relatively large traffic. In order to relieve the pressure on the database, Memcache is used as a cache area to save part of the information in the memory, so that it can be accessed quickly on the front end.
2. Memcache Win32 installation
(1) Download address:
http://www.jehiah.cz/projects/memcached-win32/
( 2) Installation steps:
step1 Unzip the compressed package to any directory, such as c:mem. The directory structure is as follows:
step2 Install memcache into the windows service: c:memmemcached.exe -d install. If there is no error message, the installation is complete.
step3 Start the memcache service: c:memmemcached.exe -d start. If there is no error message, the startup is successful. As shown in the figure below:
Note: If you do not need to add memcache to the windows service, but manually double-click to start memcached.exe in the root directory after decompression each time, you do not need step2 and step3. . The above step2 and step3 need to be operated from the command prompt.
(3) Test whether the installation is successful
After the memcache service is successfully started, you can use telnet 127.0.0.1 11211 to test whether the connection is successful; if the connection is successful, use the stats command to view the basic information of memcache. The details are shown in the figure below:
3.Memcache configuration in PHP
(1) Configuration steps
step1 Download the php_memcache.dll component and place it in the php extension component directory, such as: phpext
step2 After adding extension=php_memcache.dll to PHP.ini, restart Apache will do.
(2) Test whether the configuration is successful
Use phpinfo() to check whether it is successfully enabled. As shown in the picture below:
(3) Test memcache in PHP