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();

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2022-01-17
  • 2021-03-30
  • 2021-11-28
  • 2021-09-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2022-02-02
  • 2022-12-23
  • 2021-10-02
相关资源
相似解决方案