Home > Backend Development > PHP Tutorial > PHP MemCached advanced cache configuration

PHP MemCached advanced cache configuration

巴扎黑
Release: 2016-11-08 13:35:53
Original
1174 people have browsed it

1. What is MemCached?

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 retrieval results. 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 installation on Windows platform

(1) Download memcached 1.2.4

(2) Unzip it to a custom directory. Such as (D:memcached)

(3) Open DOS, enter the following command

D:memcachedmemcached.exe -d install

(4) Then enter

D:memcachedmemcached.exe -d start

to start. In the future, memcached will be automatically started as a service of Windows every time you boot up.

(5) D:memcachedmemcached.exe -h Display help and get the usage of various commands

3. Memcache Win32 installation and configuration in PHP

(1) Download: php_memcache.dll component (WAMP comes with it) , since php_memcache is a third-party extension, so the original PHP does not come with it and can be downloaded from the official website)

(2) Copy php_memcache.dll to the specified component directory, the default is in phpext

(3) In PHP. ini add a sentence: extension=php_memcache.dll

(4) Restart the WEB service and use the phpinfo() function to check the activation status

4. Use PHP to connect to Memcache

$mem = new Memcache;//初始化一个实例
$mem->connect('127.0.0.1', 11211) or die ("连接失败");//连接服务器地址和默认端口
$version = $mem->getVersion();//获得版本信息
echo $version;
Copy after login


Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template