- bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled

This commit is contained in:
Uwe Tews
2015-05-12 02:52:30 +02:00
parent 8acb920e20
commit c12655ded2
2 changed files with 20 additions and 14 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.23-dev ===== (xx.xx.2015)
12.05.2015
- bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled
===== 3.1.22 ===== (10.05.2015)
10.05.2015
- bugfix custom cache resource did not observe compile_id and cache_id when $cache_locking == true

View File

@@ -149,32 +149,35 @@ class Smarty_Template_Cached
}
while (true) {
while (true) {
$this->handler->populate($this, $_template);
if ($this->exists === false || $_template->smarty->force_compile || $_template->smarty->force_cache) {
$this->valid = false;
if ($this->exists === false || $_template->smarty->force_compile || $_template->smarty->force_cache) {
$valid = false;
} else {
$this->valid = true;
$valid = true;
}
if ($this->valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)) {
if ($valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)) {
// lifetime expired
$this->valid = false;
$valid = false;
}
if ($this->valid || !$_template->smarty->cache_locking) {
if ($valid && $_template->source->timestamp > $this->timestamp) {
$valid = false;
}
if ($valid || !$_template->smarty->cache_locking) {
break;
}
if (!$this->handler->locked($_template->smarty, $this)) {
$this->handler->acquireLock($_template->smarty, $this);
break 2;
}
$this->handler->populate($this, $_template);
}
if ($this->valid) {
if ($valid) {
if (!$_template->smarty->cache_locking || $this->handler->locked($_template->smarty, $this) === null) {
// load cache file for the following checks
if ($_template->smarty->debugging) {
Smarty_Internal_Debug::start_cache($_template);
}
if ($this->handler->process($_template, $this) === false) {
$this->valid = false;
$valid = false;
} else {
$this->processed = true;
}
@@ -186,19 +189,19 @@ class Smarty_Template_Cached
continue;
}
} else {
return $this->valid;
return $this->valid = $valid;
}
if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED && $_template->properties['cache_lifetime'] >= 0 && (time() > ($_template->cached->timestamp + $_template->properties['cache_lifetime']))) {
$this->valid = false;
if ($valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED && $_template->properties['cache_lifetime'] >= 0 && (time() > ($_template->cached->timestamp + $_template->properties['cache_lifetime']))) {
$valid = false;
}
if ($_template->smarty->cache_locking) {
if (!$this->valid) {
if (!$valid) {
$this->handler->acquireLock($_template->smarty, $this);
} elseif ($this->is_locked) {
$this->handler->releaseLock($_template->smarty, $this);
}
}
return $this->valid;
return $this->valid = $valid;
}
return $this->valid = false;
}