您的位置:首页 > 数据库 > Memcache

Thinkphp框架中使用memcache缓存的方法

2014-04-21 11:50 716 查看
http://blog.csdn.net/yl_wh/article/details/8538926

转载自:http://blog.163.com/qiuxinke2006@126/blog/static/24885580201201821632676/

Thinkphp的默认缓存方式是以File方式,在/Runtime/Temp 下生成了好多缓存文件。

服务器装了memcached后想给更改成memecache方式

在Conf/config.php 中添加


'DATA_CACHE_TYPE'=>'Memcache', 'MEMCACHE_HOST' => 'tcp://127.0.0.1:11211', 'DATA_CACHE_TIME'=>'3600',


下载CacheMemcache.class.php 到你的项目中。

Thinkphp 的 Action调用Memcache方法


import("@.ORG.CacheMemcache"); $cache =Cache::getInstance(); $cache->set("uid",'1231'); $cache->get("uid"); $cache->rm("uid"); $cache->clear();

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: