From d7ff1eec4748a9d25af68d055352d86e329c303d Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Tue, 5 May 2015 15:46:24 +0200 Subject: [PATCH] - optimization on cache update when main template is modified --- change_log.txt | 5 ++++- libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_template_cached.php | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/change_log.txt b/change_log.txt index a87d4383..8dc968b6 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,9 @@  ===== 3.1.22-dev ===== (xx.xx.2015) 05.05.2015 - - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23 + - optimization on cache update when main template is modified + + 05.05.2015 + - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23 04.05.2015 - bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index bb1d658f..8c41f7ad 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.22-dev/24'; + const SMARTY_VERSION = '3.1.22-dev/25'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_template_cached.php b/libs/sysplugins/smarty_template_cached.php index 7824dc48..8721e2ca 100644 --- a/libs/sysplugins/smarty_template_cached.php +++ b/libs/sysplugins/smarty_template_cached.php @@ -138,6 +138,9 @@ class Smarty_Template_Cached } else { $cached->valid = true; } + if ($cached->valid && $_template->source->timestamp > $cached->timestamp) { + $cached->valid = false; + } if ($cached->valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT && $_template->cache_lifetime >= 0 && time() > ($cached->timestamp + $_template->cache_lifetime)) { // lifetime expired $cached->valid = false;