本文整理汇总了PHP中Illuminate\Cache\Repository::rememberForever方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::rememberForever方法的具体用法?PHP Repository::rememberForever怎么用?PHP Repository::rememberForever使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Cache\Repository
的用法示例。
在下文中一共展示了Repository::rememberForever方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Settings constructor.
*
* @param CacheRepository $cache
* @param Manager $manager
*/
public function __construct(CacheRepository $cache, Manager $manager)
{
$this->cache = $cache;
parent::__construct($this->cache->rememberForever(self::CACHE_KEY, function () use($manager) {
return Entities\Settings::all()->pluck('value', 'name')->all();
}));
}
示例2: format
/**
* {@inheritdoc}
*/
protected function format($string)
{
if (!$this->watch) {
$key = 'js.' . sha1($string);
$string = $this->cache->rememberForever($key, function () use($string) {
return $this->minify($string);
});
}
return $string . ";\n";
}
示例3: rememberForever
/**
* Get an item from the cache, or store the default value forever.
*
* @param string $key
* @param \Closure $callback
*
* @return mixed
*/
public function rememberForever($key, Closure $callback)
{
if ($this->enabled) {
return $this->cache->rememberForever($key, $callback);
}
return $callback;
}
示例4: getSubTitle
/**
* Get the page sub title
*
* @param string $page
* @return string
*/
public function getSubTitle($page)
{
$pageFile = $this->getDocumentationPath() . "/{$page}.md";
return $this->cache->rememberForever("doc_page_{$pageFile}_sub-title", function () use($pageFile) {
$data = $this->parser->parse($this->finder->get($pageFile));
return $data->get('subtitle');
});
}
示例5: rememberForever
/**
* Get an item from the cache, or store the default value forever.
*
* @param string $key
* @param \Closure $callback
* @return mixed
* @static
*/
public static function rememberForever($key, $callback)
{
return \Illuminate\Cache\Repository::rememberForever($key, $callback);
}
示例6: rememberForever
/**
* Get an item from the cache, or store the default value forever.
*
* @param string $key
* @param \Closure $callback
* @return mixed
*/
public function rememberForever($key, Closure $callback)
{
if (is_array($key)) {
return $this->rememberManyForever($key, $callback);
}
return parent::rememberForever($key, $callback);
}