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


PHP Cache::start方法代码示例

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


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

示例1: createCache

 /**
  * Starts the output cache. Returns Nette\Caching\OutputHelper object if buffering was started.
  * @param  Nette\Caching\IStorage
  * @param  string
  * @param  Nette\Caching\OutputHelper[]
  * @param  array
  * @return Nette\Caching\OutputHelper
  */
 public static function createCache(Nette\Caching\IStorage $cacheStorage, $key, &$parents, array $args = NULL)
 {
     if ($args) {
         if (array_key_exists('if', $args) && !$args['if']) {
             return $parents[] = new \stdClass();
         }
         $key = array_merge([$key], array_intersect_key($args, range(0, count($args))));
     }
     if ($parents) {
         end($parents)->dependencies[Nette\Caching\Cache::ITEMS][] = $key;
     }
     $cache = new Nette\Caching\Cache($cacheStorage, 'Nette.Templating.Cache');
     if ($helper = $cache->start($key)) {
         if (isset($args['dependencies'])) {
             $args += call_user_func($args['dependencies']);
         }
         if (isset($args['expire'])) {
             $args['expiration'] = $args['expire'];
             // back compatibility
         }
         $helper->dependencies = [Nette\Caching\Cache::TAGS => isset($args['tags']) ? $args['tags'] : NULL, Nette\Caching\Cache::EXPIRATION => isset($args['expiration']) ? $args['expiration'] : '+ 7 days'];
         $parents[] = $helper;
     }
     return $helper;
 }
开发者ID:JanTvrdik,项目名称:nette-caching,代码行数:33,代码来源:CacheMacro.php

示例2: createCache

 /**
  * Starts the output cache. Returns Nette\Caching\OutputHelper object if buffering was started.
  * @param  Nette\Caching\IStorage
  * @param  string
  * @param  array of Nette\Caching\OutputHelper
  * @param  array
  * @return Nette\Caching\OutputHelper
  */
 public static function createCache(Nette\Caching\IStorage $cacheStorage, $key, &$parents, $args = NULL)
 {
     if ($args) {
         if (array_key_exists('if', $args) && !$args['if']) {
             return $parents[] = (object) NULL;
         }
         $key = array_merge(array($key), array_intersect_key($args, range(0, count($args))));
     }
     if ($parents) {
         end($parents)->dependencies[Nette\Caching\Cache::ITEMS][] = $key;
     }
     $cache = new Nette\Caching\Cache($cacheStorage, 'Nette.Templating.Cache');
     if ($helper = $cache->start($key)) {
         $helper->dependencies = array(Nette\Caching\Cache::TAGS => isset($args['tags']) ? $args['tags'] : NULL, Nette\Caching\Cache::EXPIRATION => isset($args['expire']) ? $args['expire'] : '+ 7 days');
         $parents[] = $helper;
     }
     return $helper;
 }
开发者ID:rostenkowski,项目名称:HttpPHPUnit,代码行数:26,代码来源:DefaultMacros.php

示例3: createCache

 /**
  * @param \Nette\Caching\IStorage $cacheStorage
  * @param string $key
  * @param mixed $parents
  * @param $template
  * @param mixed[] $args
  * @return \Nette\Caching\OutputHelper
  */
 public static function createCache(IStorage $cacheStorage, $key, &$parents, $template, array $args = null)
 {
     if ($args) {
         if (array_key_exists('if', $args) && !$args['if']) {
             return self::$parents[] = $parents[] = new \stdClass();
         }
         $key = array_merge(array($key), array_intersect_key($args, range(0, count($args))));
     }
     if ($parents) {
         end($parents)->dependencies[Cache::ITEMS][] = $key;
     }
     if (count(self::$parents)) {
         end(self::$parents)->dependencies[Cache::ITEMS][] = $key;
     }
     $cache = new Cache($cacheStorage, 'Nette.Templating.Cache');
     if ($helper = $cache->start($key)) {
         if (isset($args['expire'])) {
             $args['expiration'] = $args['expire'];
             // back compatibility
         }
         $helper->dependencies = array(Cache::TAGS => isset($args['tags']) ? $args['tags'] : null, Cache::EXPIRATION => isset($args['expiration']) ? $args['expiration'] : '+ 7 days', Cache::FILES => array($template));
         self::$parents[] = $parents[] = $helper;
     }
     return $helper;
 }
开发者ID:venne,项目名称:venne,代码行数:33,代码来源:GlobalCacheMacro.php

示例4:

initRuntime(Nette\Templating\FileTemplate$template,\stdClass$global){if(!empty($global->caches)){end($global->caches)->dependencies[Nette\Caching\Cache::FILES][]=$template->getFile();}}static
function
createCache(Nette\Caching\IStorage$cacheStorage,$key,&$parents,array$args=NULL){if($args){if(array_key_exists('if',$args)&&!$args['if']){return$parents[]=(object)NULL;}$key=array_merge(array($key),array_intersect_key($args,range(0,count($args))));}if($parents){end($parents)->dependencies[Nette\Caching\Cache::ITEMS][]=$key;}$cache=new
Nette\Caching\Cache($cacheStorage,'Nette.Templating.Cache');if($helper=$cache->start($key)){if(isset($args['expire'])){$args['expiration']=$args['expire'];}$helper->dependencies=array(Nette\Caching\Cache::TAGS=>isset($args['tags'])?$args['tags']:NULL,Nette\Caching\Cache::EXPIRATION=>isset($args['expiration'])?$args['expiration']:'+ 7 days');$parents[]=$helper;}return$helper;}}use
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:4,代码来源:loader.php


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