Adding cache lifetime option to smarty config
* Renamed configuration array to `smarty` => `cache` * Added `smarty` => `cache_lifetime` to expire cache files properly This should be safe to use, be aware that each page request is cached! That includes any POST/GET calls to the site. It does help in speeding up the site, up to 100% on some requests. For a high traffic site it probably makes sense to enable this option with a low cache lifetime to ensure most recent data. Addresses #309
This commit is contained in:
parent
420ae332b5
commit
3449d5c29c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
/public/include/config/global.inc.php
|
/public/include/config/global.inc.php
|
||||||
/public/templates/compile/*.php
|
/public/templates/compile/*.php
|
||||||
/cronjobs/logs/*.txt
|
/cronjobs/logs/*.txt
|
||||||
|
/public/templates/cache/*.php
|
||||||
|
|||||||
@ -275,13 +275,20 @@ $config['cookie']['domain'] = '';
|
|||||||
*
|
*
|
||||||
* Ensure that the folder `templates/cache` is writable by the webserver!
|
* Ensure that the folder `templates/cache` is writable by the webserver!
|
||||||
*
|
*
|
||||||
* Options:
|
* cache = Enable/Disable the cache
|
||||||
* 0 = disabled
|
* cache_lifetime = Time to keep files in seconds before updating them
|
||||||
* 1 = enabled
|
|
||||||
*
|
*
|
||||||
* Default:
|
* Options:
|
||||||
* 0 = disabled
|
* cache:
|
||||||
|
* 0 = disabled
|
||||||
|
* 1 = enabled
|
||||||
|
* cache_lifetime:
|
||||||
|
* time in seconds
|
||||||
|
*
|
||||||
|
* Defaults:
|
||||||
|
* cache = 0, disabled
|
||||||
|
* cache_lifetime = 30 seconds
|
||||||
**/
|
**/
|
||||||
$config['cache'] = 0;
|
$config['smarty']['cache'] = 1;
|
||||||
|
$config['smarty']['cache_lifetime'] = 30;
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -20,6 +20,7 @@ $smarty->template_dir = BASEPATH . 'templates/' . THEME . '/';
|
|||||||
$smarty->compile_dir = BASEPATH . 'templates/compile/';
|
$smarty->compile_dir = BASEPATH . 'templates/compile/';
|
||||||
|
|
||||||
// Optional smarty caching, check Smarty documentation for details
|
// Optional smarty caching, check Smarty documentation for details
|
||||||
$smarty->caching = $config['cache'];
|
$smarty->caching = $config['smarty']['cache'];
|
||||||
|
$smarty->cache_lifetime = $config['smarty']['cache_lifetime'];
|
||||||
$smarty->cache_dir = BASEPATH . "templates/cache";
|
$smarty->cache_dir = BASEPATH . "templates/cache";
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user