/**
  * Empty cache for this template
  *
  * @param integer $exp_time expiration time
  *
  * @return integer number of cache files deleted
  */
 public function clearCache($exp_time = null)
 {
     Smurty_CacheResource::invalidLoadedCache($this->smurty);
     return $this->cached->handler->clear($this->smurty, $this->template_name, $this->cache_id, $this->compile_id, $exp_time);
 }
 /**
  * Write this cache object to handler
  *
  * @param Smurty_Internal_Template $_template template object
  * @param string                   $content   content to cache
  *
  * @return boolean success
  */
 public function write(Smurty_Internal_Template $_template, $content)
 {
     if (!$_template->source->recompiled) {
         if ($this->handler->writeCachedContent($_template, $content)) {
             $this->content = null;
             $this->timestamp = time();
             $this->exists = true;
             $this->valid = true;
             if ($_template->smurty->cache_locking) {
                 $this->handler->releaseLock($_template->smurty, $this);
             }
             return true;
         }
     }
     return false;
 }
Beispiel #3
0
 /**
  * Empty cache for a specific template
  *
  * @param  string  $template_name template name
  * @param  string  $cache_id      cache id
  * @param  string  $compile_id    compile id
  * @param  integer $exp_time      expiration time
  * @param  string  $type          resource type
  *
  * @return integer number of cache files deleted
  */
 public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
 {
     // load cache resource and call clear
     $_cache_resource = Smurty_CacheResource::load($this, $type);
     Smurty_CacheResource::invalidLoadedCache($this);
     return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time);
 }