The ecshop cache is stored in the Templates/caches/article folder, which can be very large for a long time, slowing down the website speed. There are a lot of situations where we don't need his cache. This article describes how to disable Ecshop caching.
The Ecshop cache has two parts, part of which is the Smarty page cache, and the other is the cache of SQL query results. Both sections are saved under the Templates/caches/folder. As long as we close these two functions separately, we can disable the Ecshop cache completely. Of course you can also close one of them according to your own needs.
1. Close the Smarty cache:
Open the includes/cls_template.php and find the following paragraph
if (file_put_contents ($this->cache_dir. ‘/’ . $cachename. '. php ', ' <?php exit;? > '. $data. $out) = = = False)
{
Trigger_error (' can\ ' t write: '. $this->cache_dir. ‘/’ . $cachename. '. php ');
}
Comment out this section and change it to
/*
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. Close the SQL query results cache
Open includes/cls_mysql.php
Found it
var $max _cache_time=3600;//Maximum cache time, in seconds
Switch
var $max _cache_time=0;//Maximum cache time, in seconds
--------------------------------------------
How do I restrict or disable Ecshop caching? As long as the FTP log on to the host space server, the "templates/caches" folder to clear the cache files, but the more secure way is to enter the Ecshop shop backstage Click the "Clear Cache" button in the upper right corner. Or completely disable the Ecshop caching feature.
One, disable ecshop Partial data table cache .
Ecshop caches folder cache files include the SQL query results cache and the Smarty template page cache. If there are more users visiting the site, these temporary cache data is kept in the Ecshop "templates/caches" folder. Data caching can improve the speed of the store, but the cache file more than a lot of. Some say that caching is disabled only for favourable_activity,goods_activity 2 tables.
Open include/init.php and find
PHP Code
- $db->set_disable_cache_tables (array ($ecs->table (' Sessions '), $ecs->table (' Sessions_data ') , $ecs->table (' cart '));
Revision changed to
PHP Code
- $db->set_disable_cache_tables (array ($ecs->table (' Sessions '), $ecs->table (' Sessions_data '), $ecs->table (' cart '), $ecs->table (' favourable_activity '), $ecs->table (' goods_activity ')));
Second, completely disable the Ecshop cache
Regular login to the Ecshop store background to clear the cache files, for lazy people, this is also very troublesome. Then simply disable the Ecshop cache altogether. Refer to the Bug's disabled Echsop cache article, the specific code for the bug is 2.6.0 or so version. The 2.7 Ecshop disables cache modification methods similar to the following:
1. Open include/cls_template.php with editplus and comment out the following code:
PHP Code
- /* IF (file_put_contents ($hash _dir. ‘/’ . $cachename. '. php ', ' <?php exit;? > '. $data. $out, lock_ex) = = = False)
- {
- Trigger_error (' can\ ' t write: '. $hash _dir. ‘/’ . $cachename. '. php ');
- } */
2. Open include/cls_mysql.php with editplus , find max_cache_time = 300, change 300 to 0
Third, can the file under templates/compiled be emptied?
The file under Templates/compiled is the template after the file is compiled and can be emptied. When users browse the store, they are regenerated. Templates folder is mostly caches cache files too much, you can periodically empty or completely disable Ecshop cache.
----------------------------------------------
suggestions for clearing the cache !
Find out now the clear cache does the comparison coarse! And no big changes before! Same as 2.0.5. backstage any modified operation, the entire cache is gone! $smarty->clear_all_cache (); cons: If I have 100,000 goods,:), and have been browsed, I have a operation in the background should be clear 150,000 more cache file:) seems to have a point. Smarty do you have this function inside? Clear_cache (), I small modified under, added can specify delete a classification cache! 2.0.5 I changed that, and in the root directory to create a cache directory templates_caches, built Article,article_cat,goods, goods_cat,4 folders to put the article content, article list, product content, the cache of the list of items example: changes to the product, the article section foreground init.php and background init.php Add the following code, I just added it to the config.php for convenience.
- Cache directory Settings
- Define (' Ecs_root ', substr (DirName (__file__), 0,-8));//The numbers of the front and back are certainly different:)
- Article cache
- $cache _dir_article = Ecs_root. /templates_caches/article ';
- $cache _dir_article_cat = Ecs_root. /templates_caches/article_cat ';
- Commodity cache
- $cache _dir_goods = Ecs_root. /templates_caches/goods ';
- $cache _dir_goods_cat = Ecs_root. /templates_caches/goods_cat ';
Copy CodeFront Desk product content and classification cacheThe time is set to a few longer, such as content one months, Category 1 days Modify the background, where the product is modified only to delete the cache of this product content Delete the commodity classification cache andHome Cache! Add the following $smarty->clear_cache (null, NULL, NULL, NULL, $cache _dir_goods_cat);//ZOUQL: Delete catalog cache, default cache time $smarty->clear_cache (' goods.html ', $goods _id, NULL, NULL, $cache _dir_goods);//ZOUQL: Delete commodity cache, default cache time And alsoAdvertisingManagement and so on and so on and so on. Front deskAfter users post commentsAutomatically delete this product cache, etc... function Clear_cache ($TPL _file = null, $cache _id = null, $compile _id = null, $exp _time = null,$cache _dir = null) { if (!isset ($cache _dir)) $cache _dir = $this->cache_dir; if (!isset ($compile _id)) $compile _id = $this->compile_id; if (!isset ($tpl _file)) $compile _id = null; $_auto_id = $this->_get_auto_id ($cache _id, $compile _id); if (!empty ($this->cache_handler_func)) { Return Call_user_func_array ($this->cache_handler_func, Array (' Clear ', & $this, & $dummy, $tpl _file, $cache _id, $compile _id, $exp _time)); } else { $_params = Array (' auto_base ' = = $cache _dir, & nbsp ' Auto_source ' + $tpl _file, ' auto_id ' = $_auto_id, ' exp_time ' =& Gt $exp _time); require_once (smarty_core_dir. ' core.rm_auto.php '); return Smarty_core_rm_auto ($_params, $ this); } } |
---------------------------------------------
periodically clear the cache page plugin
Software type: domestic software
Licensing method: Shareware
interface language: Simplified Chinese
software size: unknown
file type:. rar
Operating Environment: Win2003,winxp,win2000,win9x
software level:★★★★★
release time:2009-08-26
official website:/http
demo URL: http
://Download Count
Software Introduction
Use Ecshop's plans and tasks to clear too many cached paging files
Important NOTES:
1. Applicable to Utf-8 coding;
2. the path of languages within the original download package is wrong, the correct is: languages\zh_cn\cron\myclr.php
Everyone, come out and welcome wutao0808.
wutao0808 files are tested without problems and will not damage the system
I do a backup in this post, the following first for the landlord's file, clear cache, but do not clear the template of the compilation directly copied to the root directory of the mall can be
The following is a file that I made a slight change to make a comment, the default is to clear all files (including cache and template compilation), if you simply cache the file clearly, comment out
Clear_all_files (); Change to//clear_all_files ();
The cached uncomment//clear_cache_files () will be cleared; Change to//clear_cache_files (); Can
Ecshop Cache Cleanup-Limit or disable Ecshop caching