『轉』彻底禁用ECSHOP的缓存

转自:http://roln.cn/2008/08/27/lamp/ecshop-memcache/

ECSHOP的缓存存放在templates/caches/文章夹下,时间长了这个文件夹就会非常庞大,拖慢网站速度。还有很多情况我们不需要他的缓存。本文介绍禁用ECSHOP缓存的方法。

  ECSHOP的缓存有两部分,一部分是SMARTY的页面缓存;另一部分是SQL查询结果的缓存。这两部分都是保存在templates/caches/文件夹下。只要我们分别关闭这两个功能,就可以完全禁用ECSHOP的缓存。当然你也可以根据自己的需要关闭其中某一个。

  1.关闭SMARTY的缓存:
  打开includes/cls_template.php,找到下面一段

  if (file_put_contents($this->cache_dir . ‘/’ . $cachename . ‘.php’, ‘<?php exit;?>’ . $data . $out) === false)
       {
           trigger_error(’can\’t write:’ . $this->cache_dir . ‘/’ . $cachename . ‘.php’);
       }

  将这一部分注释掉即可,改成

/*
  if (file_put_contents($this->cache_dir . ‘/’ . $cachename . ‘.php’, ‘<?php exit;?>’ . $data . $out) === false)
       {
           trigger_error(’can\’t write:’ . $this->cache_dir . ‘/’ . $cachename . ‘.php’);
       }
*/

  2.关闭SQL查询结果缓存
  打开includes/cls_mysql.php 
  找到
    var $max_cache_time=3600;//最大的缓存时间,以秒为单位
  改为
     var $max_cache_time=0;//最大的缓存时间,以秒为单位

原文地址:https://www.cnblogs.com/abinxm/p/1527067.html