当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::release方法代码示例

本文整理汇总了PHP中Nette\Caching\Cache::release方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::release方法的具体用法?PHP Cache::release怎么用?PHP Cache::release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Caching\Cache的用法示例。


在下文中一共展示了Cache::release方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Renders template to output.
  * @return void
  */
 public function render()
 {
     if ($this->file == NULL) {
         // intentionally ==
         throw new Nette\InvalidStateException("Template file name was not specified.");
     }
     $cache = new Caching\Cache($storage = $this->getCacheStorage(), 'Nette.FileTemplate');
     if ($storage instanceof Caching\Storages\PhpFileStorage) {
         $storage->hint = str_replace(dirname(dirname($this->file)), '', $this->file);
     }
     $cached = $compiled = $cache->load($this->file);
     if ($compiled === NULL) {
         try {
             $compiled = "<?php\n\n// source file: {$this->file}\n\n?>" . $this->compile();
         } catch (FilterException $e) {
             $e->setSourceFile($this->file);
             throw $e;
         }
         $cache->save($this->file, $compiled, array(Caching\Cache::FILES => $this->file, Caching\Cache::CONSTS => 'Nette\\Framework::REVISION'));
         $cache->release();
         $cached = $cache->load($this->file);
     }
     if ($cached !== NULL && $storage instanceof Caching\Storages\PhpFileStorage) {
         Nette\Utils\LimitedScope::load($cached['file'], $this->getParams());
     } else {
         Nette\Utils\LimitedScope::evaluate($compiled, $this->getParams());
     }
 }
开发者ID:kovkus,项目名称:r-cms,代码行数:32,代码来源:FileTemplate.php

示例2: render

 /**
  * Renders template to output.
  * @return void
  */
 public function render()
 {
     if ($this->file == NULL) {
         // intentionally ==
         throw new \InvalidStateException("Template file name was not specified.");
     }
     $this->__set('template', $this);
     $shortName = str_replace(dirname(dirname($this->file)), '', $this->file);
     $cache = new Cache($this->getCacheStorage(), 'Nette.FileTemplate');
     $key = trim(strtr($shortName, '\\/@', '.._'), '.') . '-' . md5($this->file);
     $cached = $content = $cache[$key];
     if ($content === NULL) {
         if (!$this->getFilters()) {
             $this->onPrepareFilters($this);
         }
         if (!$this->getFilters()) {
             LimitedScope::load($this->file, $this->getParams());
             return;
         }
         $content = $this->compile(file_get_contents($this->file), "file …{$shortName}");
         $cache->save($key, $content, array(Cache::FILES => $this->file, Cache::EXPIRE => self::$cacheExpire, Cache::CONSTS => 'Nette\\Framework::REVISION'));
         $cache->release();
         $cached = $cache[$key];
     }
     if ($cached !== NULL && self::$cacheStorage instanceof TemplateCacheStorage) {
         LimitedScope::load($cached['file'], $this->getParams());
         fclose($cached['handle']);
     } else {
         LimitedScope::evaluate($content, $this->getParams());
     }
 }
开发者ID:JPalounek,项目名称:IconStore,代码行数:35,代码来源:FileTemplate.php

示例3: render

 /**
  * Renders template to output.
  * @return void
  */
 public function render()
 {
     if ($this->file == NULL) {
         // intentionally ==
         throw new \InvalidStateException("Template file name was not specified.");
     }
     $this->__set('template', $this);
     $cache = new Cache($storage = $this->getCacheStorage(), 'Nette.FileTemplate');
     if ($storage instanceof TemplateCacheStorage) {
         $storage->hint = str_replace(dirname(dirname($this->file)), '', $this->file);
     }
     $cached = $content = $cache[$this->file];
     if ($content === NULL) {
         try {
             $content = $this->compile(file_get_contents($this->file));
             $content = "<?php\n\n// source file: {$this->file}\n\n?>{$content}";
         } catch (TemplateException $e) {
             $e->setSourceFile($this->file);
             throw $e;
         }
         $cache->save($this->file, $content, array(Cache::FILES => $this->file, Cache::CONSTS => 'Nette\\Framework::REVISION'));
         $cache->release();
         $cached = $cache[$this->file];
     }
     if ($cached !== NULL && $storage instanceof TemplateCacheStorage) {
         LimitedScope::load($cached['file'], $this->getParams());
         flock($cached['handle'], LOCK_UN);
         fclose($cached['handle']);
     } else {
         LimitedScope::evaluate($content, $this->getParams());
     }
 }
开发者ID:JanTvrdik,项目名称:nette,代码行数:36,代码来源:FileTemplate.php

示例4: render

 /**
  * Renders template to output.
  * @return void
  */
 public function render()
 {
     $cache = new Caching\Cache($storage = $this->getCacheStorage(), 'Nette.Template');
     $cached = $compiled = $cache->load($this->source);
     if ($compiled === NULL) {
         $compiled = $this->compile();
         $cache->save($this->source, $compiled, array(Caching\Cache::CONSTS => 'Nette\\Framework::REVISION'));
         $cache->release();
         $cached = $cache->load($this->source);
     }
     if ($cached !== NULL && $storage instanceof Caching\Storages\PhpFileStorage) {
         Nette\Utils\LimitedScope::load($cached['file'], $this->getParams());
     } else {
         Nette\Utils\LimitedScope::evaluate($compiled, $this->getParams());
     }
 }
开发者ID:hleumas,项目名称:databaza,代码行数:20,代码来源:Template.php


注:本文中的Nette\Caching\Cache::release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。