PHPMemCached advanced cache configuration graphic tutorial _ PHP Tutorial

Source: Internet
Author: User
PHPMemCached advanced cache configuration graphic 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 image, video, file, and database checks. 1. Introduction to Memcache

Memcache is a high-performance distributed memory object cache system that can store data in various formats, including images, videos, files, and database retrieval results.
Memcache websites generally have a large traffic volume. to relieve the pressure on the database, apsaradb for Memcache is used as a cache area and some information is stored in the memory, allowing quick access at the front end.

2. install Memcache Win32
(1 ):
Http://www.jehiah.cz/projects/memcached-win32/
(2) installation steps:
Step 1 extract the compressed package to any Directory, such as c: \ mem. The directory structure is as follows:

Step 2 install memcache in windows: c: \ mem \ memcached.exe-d install. If no error message is displayed, the installation is complete.
Step 3 start the memcache service: c: \ mem \ memcached.exe-d start. If no error message is displayed, the memcache service is successfully started. As shown in:

Note: If memcached.exe is enabled in the root directory after memcached.exe is automatically removed from the Windows service, step 2 and step 3 are not required. The preceding steps 2 and step 3 must be performed at 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, run the stats command to view the basic information of memcache. As shown in:

3. configure Memcache in PHP

(1) configuration steps

Step 1 download the php_memcache.dll component and place it in the php extension component directory, such as php \ ext \
Step 2 add extension = php_memcache.dll to PHP. ini and restart Apache.

(2) test whether the configuration is successful

Use phpinfo () to check whether it is enabled successfully. As shown in:

(3) test memcache in PHP

The code is as follows:


$ Mem = new Memcache;
$ Mem-> connect ('127. 0.0.1 ', 127) or die ("connection failed ");
$ Mem-> getVersion ();
?>

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 database checks...

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.