74 if ($_template->cached->handler->process($_template)) {
76 $_template->properties[
'unifunc']($_template);
77 return ob_get_clean();
101 public abstract function clear(
Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);
109 while ($this->
hasLock($smarty, $cached)) {
111 if (microtime(
true) -
$start > $smarty->locking_timeout) {
149 $type = $smarty->caching_type;
153 if (isset($smarty->_cacheresource_handlers[$type])) {
154 return $smarty->_cacheresource_handlers[$type];
158 if (isset($smarty->registered_cache_resources[$type])) {
160 return $smarty->_cacheresource_handlers[$type] = $smarty->registered_cache_resources[$type];
163 if (isset(self::$sysplugins[$type])) {
164 if (!isset(self::$resources[$type])) {
165 $cache_resource_class =
'Smarty_Internal_CacheResource_' . ucfirst($type);
166 self::$resources[$type] =
new $cache_resource_class();
168 return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];
171 $cache_resource_class =
'Smarty_CacheResource_' . ucfirst($type);
172 if ($smarty->
loadPlugin($cache_resource_class)) {
173 if (!isset(self::$resources[$type])) {
174 self::$resources[$type] =
new $cache_resource_class();
176 return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];
189 foreach ($smarty->template_objects as
$tpl) {
190 if (isset($tpl->cached)) {
191 $tpl->cached->valid =
false;
192 $tpl->cached->processed =
false;
287 $this->compile_id = $_template->compile_id;
288 $this->cache_id = $_template->cache_id;
289 $this->source = $_template->source;
290 $_template->cached = $this;
291 $smarty = $_template->smarty;
302 $handler->populate($this, $_template);
307 $handler->populate($this, $_template);
308 if ($this->timestamp ===
false || $smarty->force_compile || $smarty->force_cache) {
309 $this->valid =
false;
313 if ($this->valid && $_template->caching ==
Smarty::CACHING_LIFETIME_CURRENT && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)) {
315 $this->valid =
false;
317 if ($this->valid || !$_template->smarty->cache_locking) {
320 if (!$this->handler->locked($_template->smarty, $this)) {
321 $this->handler->acquireLock($_template->smarty, $this);
326 if (!$_template->smarty->cache_locking || $this->handler->locked($_template->smarty, $this) === null) {
328 if ($smarty->debugging) {
331 if(
$handler->process($_template, $this) ===
false) {
332 $this->valid =
false;
334 $this->processed =
true;
336 if ($smarty->debugging) {
345 if ($this->valid && $_template->caching ===
Smarty::CACHING_LIFETIME_SAVED && $_template->properties[
'cache_lifetime'] >= 0 && (time() > ($_template->cached->timestamp + $_template->properties[
'cache_lifetime']))) {
346 $this->valid =
false;
348 if (!$this->valid && $_template->smarty->cache_locking) {
349 $this->handler->acquireLock($_template->smarty, $this);
366 if (!$_template->source->recompiled) {
367 if ($this->handler->writeCachedContent($_template,
$content)) {
368 $this->timestamp = time();
369 $this->exists =
true;
371 if ($_template->smarty->cache_locking) {
372 $this->handler->releaseLock($_template->smarty, $this);
releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
static load(Smarty $smarty, $type=null)
Load Cache Resource Handler.
loadPlugin($plugin_name, $check=true)
Takes unknown classes and loads plugin files for them class name format: Smarty_PluginType_PluginName...
static start_cache($template)
Start logging of cache time.
static invalidLoadedCache(Smarty $smarty)
Invalid Loaded Cache Files.
__construct(Smarty_Internal_Template $_template)
create Cached Object container
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
static end_cache($template)
End logging of cache time.
const CACHING_LIFETIME_CURRENT
Smarty plugin to format text blocks.
populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
populate Cached Object with meta data from Resource
process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
Read the cached template and process header.
write(Smarty_Internal_Template $_template, $content)
Write this cache object to handler.
locked(Smarty $smarty, Smarty_Template_Cached $cached)
populateTimestamp(Smarty_Template_Cached $cached)
populate Cached Object with timestamp and exists from Resource
const CACHING_LIFETIME_SAVED
hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
getCachedContent(Smarty_Internal_Template $_template)
Return cached content.
clearAll(Smarty $smarty, $exp_time=null)
Empty cache.
writeCachedContent(Smarty_Internal_Template $_template, $content)
Write the rendered template output to cache.
clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
Empty cache for a specific template.
acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)