Thinkphpmemcache usage example
| For usage of memcache in thinkphp, including how to install and run memcache in ThinkPHP, and how to use memcache in thinkphp, refer to the example of using memcache as a cache in thinkphp.
Memcache cache usage in thinkphp
1. download and install memcache1) install memcache in Windows. download memcached.exe to d:/memcached/memcached.exe. run cmd and enter "d:/memcached/memcached.exe-d install. 2) run d:/memcached/memcached.exe-d start to start memcache3), download php_memcache.dll to php installation directory extension directory php \ ext4), and modify php. add extension = php_memcache.dll to ini and restart apache. view phpinfo. if the memcache module exists in php, the installation is successful.
2. use memcache in thinkphp1), ThinkPHP/conf/convention. php modify the cache type 'Data _ CACHE_TYPE '=> 'memcaccache', // DATA cache type,
Supported: File | Db | Apc | Memcache | Shmop | Sqlite | Xcache | Apachenote | Eaccelerator2) and thinkphp official download extensions ThinkPHP_Extend_3.1.2/Extend/Driver/Cache/CacheMemcache. class. save php to: ThinkPHP/Lib/Driver/Cache/CacheMemcache. class. php
3) test: S ('test', 'memcache'); $ test = S ('test'); echo $ test;
Output memcache, indicating that the test is successful. |