PHP MemCached Advanced Cache Configuration

Source: Internet
Author: User
Tags php memcached
1. What is memcached?

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. The use of Memcache website general traffic is relatively large, in order to alleviate the pressure of the database, let Memcache as a cache area, the part of the information stored in memory, in the front-end can be quickly accessed.

2. Installation of memcache on Windows platform

(1) Download memcached 1.2.4

(2) Unzip to the custom directory. such as (D:\memcached)

(3) Open DOS, enter the following command

D:\memcached\memcached.exe-d Install

(4) Re-enter

D:\memcached\memcached.exe-d start

Start. Memcached will start automatically every time a service is turned on for Windows.

(5) D:\memcached\memcached.exe-h Display Help, get the use of various commands

3. Installation of Memcache Win32 and configuration in PHP

(1) Download: Php_memcache.dll components (Wamp, since Php_memcache is a third-party extension, so the original PHP is not self-brought, can be downloaded to the official website)

(2) Copy Php_memcache.dll to the specified component directory, default in php\ext\

(3) Add a sentence in php.ini: Extension=php_memcache.dll

(4) Restart the Web service and use the Phpinfo () function to view the enabled condition

4. Connect Memcache with PHP

$mem = new memcache;//Initializes an instance of $mem->connect (' 127.0.0.1 ', 11211) or Die ("Connection Failed");//connection server address and default port $version = $mem GetVersion ();//Get version information echo $version;
  • 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.