Home >Backend Development >PHP Tutorial >smarty cache application and clearing
1. Smarty cache configuration
$smarty->cache_dir = "/caches/"; //cache directory
$smarty->caching = true; //Enable caching. When it is flase, the cache will be invalid.
$smarty->cache_lifetime = 60; //slow
1. Smarty cache configuration $smarty->cache_dir = "/caches/"; //cache directory $smarty->caching = true; //Enable caching. When it is flase, the cache will be invalid. $smarty->cache_lifetime = 60; //Cache time 2. Using and clearing Smarty cache $smarty->display('cache.tpl', cache_id); //Create a cache with ID $smarty->clear_all_cache(); //Clear all caches $smarty->clear_cache('index.htm'); //Clear the cache of index.tpl $smarty->clear_cache('index.htm',cache_id); //Clear the cache of the specified id |