update of cache resources for template function calls in nocache mode

This commit is contained in:
Uwe Tews
2014-11-09 10:20:06 +01:00
parent 223cdc0787
commit adc6091c4d
4 changed files with 81 additions and 0 deletions
@@ -126,6 +126,29 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
return $this->write(array($_template->cached->filepath => $content), $_template->properties['cache_lifetime']);
}
/**
* Read cached template from cache
*
* @param Smarty_Internal_Template $_template template object
*
* @return string content
*/
public function readCachedContent(Smarty_Internal_Template $_template)
{
$content = $_template->cached->content ? $_template->cached->content : null;
$timestamp = null;
if ($content === null) {
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp, $_template->source->uid)) {
return false;
}
}
if (isset($content)) {
return $content;
}
return false;
}
/**
* Empty cache
* {@internal the $exp_time argument is ignored altogether }}