本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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