Home > Backend Development > PHP Tutorial > Usage examples of memcache in thinkphp, thinkphpmemcache_PHP tutorial

Usage examples of memcache in thinkphp, thinkphpmemcache_PHP tutorial

WBOY
Release: 2016-07-13 10:12:41
Original
898 people have browsed it

Usage examples of memcache in thinkphp, thinkphpmemcache

The example in this article describes the usage of memcache in thinkphp. Share it with everyone for your reference. The specific analysis is as follows:

1. Download and install memcache

① Install memcache under window. Download memcached.exe to d:/memcached/memcached.exe. Run cmd and enter                                                                                                                                                                                                                                                          .

② Run d:/memcached/memcached.exe -d start to start memcache

③ Download php_memcache.dll to the php installation directory extension directory phpext

④ Modify php.ini and add extension=php_memcache.dll. Restart apache. Check phpinfo.php. If there is memcache module, it means the installation is successful

2. Use of memcache in thinkphp

① ThinkPHP/conf/convention.php Modify cache type

Copy code The code is as follows:
'DATA_CACHE_TYPE' => 'Memcache', // Data cache type,

Supports: File|Db|Apc|Memcache|Shmop|Sqlite|Xcache|Apachenote|Eaccelerator

② thinkphp official download extension ThinkPHP_Extend_3.1.2/Extend/Driver/Cache/CacheMemcache.class.php save to ThinkPHP/Lib/Driver/Cache/CacheMemcache.class.php

③ Test:

Copy code The code is as follows:
S('test','memcache');$test = S('test '); echo $test;

Output memcache test successful.

I hope this article will be helpful to everyone’s ThinkPHP framework programming.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/919625.htmlTechArticleUsage examples of memcache in thinkphp, thinkphpmemcache This article describes the usage of memcache in thinkphp. Share it with everyone for your reference. The specific analysis is as follows: 1. Download and install...
Related labels:
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