當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。