彻底禁用ECSHOP的缓存

  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;//最大的缓存时间,以秒为单位


( ! ) Warning: Missing argument 1 for cwppos_show_review(), called in /data/www/enjoyphp/wp-content/themes/flat/content-single.php on line 29 and defined in /data/www/enjoyphp/wp-content/plugins/wp-product-review/includes/legacy.php on line 18
Call Stack
#TimeMemoryFunctionLocation
10.0001355176{main}( ).../index.php:0
20.0001355464require( '/data/www/enjoyphp/wp-blog-header.php' ).../index.php:17
30.200310163792require_once( '/data/www/enjoyphp/wp-includes/template-loader.php' ).../wp-blog-header.php:19
40.202010234936include( '/data/www/enjoyphp/wp-content/themes/flat/single.php' ).../template-loader.php:74
50.300710798760get_template_part( ).../single.php:5
60.300710799280locate_template( ).../general-template.php:167
70.300710799376load_template( ).../template.php:643
80.300810799760require( '/data/www/enjoyphp/wp-content/themes/flat/content-single.php' ).../template.php:686
90.309110786256cwppos_show_review( ).../content-single.php:29

1 评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注