getCache() public method

public getCache ( )
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function compile($path, $reset = false)
 {
     if ($reset) {
         $cache = $this->twig->getCache();
         $this->twig->setCache(false);
     }
     $this->get($path);
     if ($reset && !empty($cache)) {
         //Restoring cache
         $this->twig->setCache($cache);
     }
 }
 /**
  * Loads a template by name.
  *
  * @param string  $name	 The template name
  * @param integer $index The index if it is an embedded template
  *
  * @return Twig_TemplateInterface A template instance representing the given template name
  */
 public function loadTemplate($name, $index = null)
 {
     try {
         return parent::loadTemplate($name, $index);
     } catch (RuntimeException $excpt) {
         $message = Ai1ec_I18n::__('We detected that your cache directory (%s) is not writable. This will make your calendar slow. Please contact your web host or server administrator to make it writable by the web server.');
         $message = sprintf($message, $this->cache);
         $this->_registry->get('notification.admin')->store($message, 'error', 1);
         $settings = $this->_registry->get('model.settings');
         /* @var $settings Ai1ec_Settings */
         // used shutdown to store settings
         // after this line exception occurs
         $type = is_writable(parent::getCache()) ? 'AI1EC_CACHE_UNAVAILABLE' : '';
         $settings->set('twig_cache', $type)->persist();
     }
 }
 public function __destruct()
 {
     $filesystem = new Filesystem();
     $filesystem->remove($this->environment->getCache());
 }
 /**
  * Delete all cached templates
  */
 public function onCacheClear()
 {
     if ($this->twig->getCache() and is_dir($this->twig->getCache())) {
         $this->deleteTwigFilesFrom($this->twig->getCache());
     }
 }