本文整理汇总了PHP中Illuminate\Cache\Repository::forever方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::forever方法的具体用法?PHP Repository::forever怎么用?PHP Repository::forever使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Cache\Repository
的用法示例。
在下文中一共展示了Repository::forever方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPluginsToCache
/**
* XE3에 존재하는 플러그인의 PluginEntity 목록을 캐시에 저장한다.
*
* @param array $plugins 캐시에 저장할 plugin info 목록
*
* @return void
*/
public function setPluginsToCache(array $plugins)
{
$this->plugins = $plugins;
$dataJson = json_enc($plugins);
// save plugins info to cache
$this->cache->forever($this->cacheKey, $dataJson);
}
示例2: save
/**
* {@inheritdoc}
*/
public function save($key, CacheEntry $data)
{
try {
$lifeTime = $data->getTTL();
if ($lifeTime === 0) {
return $this->cache->forever($key, serialize($data));
} else {
if ($lifeTime > 0) {
return $this->cache->add($key, serialize($data), $lifeTime);
}
}
} catch (\Exception $ignored) {
// No fail if we can't save it the storage
}
return false;
}
示例3: makeCacheKey
/**
* make a cache key
*
* @param string $key
* @param string $prefix
* @return string
*/
private function makeCacheKey($key, $prefix = '')
{
$key = md5($prefix . $key);
$keys = $this->cache->get(self::CACHE_KEYS_KEY, []);
$keys[$key] = $key;
$this->cache->forever(self::CACHE_KEYS_KEY, $keys);
return $key;
}
示例4: findAndInstallThemes
/**
* Create a cache of the themes which are available on the filesystem.
*
* @return array
*/
public function findAndInstallThemes()
{
$theme = new Theme();
$directories = $this->filesystem->directories($theme->getThemesDirectory());
$themes = [];
if (is_array($directories)) {
foreach ($directories as $directory) {
$themeName = basename($directory);
$themes[] = new Theme($themeName);
}
}
$this->cache->forever($this->cacheKey, $themes);
return $themes;
}
示例5: search
public function search(Repository $cache, $search = 'enchantment')
{
$client = new Client(config('algolia.connections.main.id'), config('algolia.connections.main.key'));
//if ($cache->has('origins.'. $search)) {
// $cards = $cache->get($search);
//} else {
$index = $client->initIndex(config('algolia.index'));
$index->setSettings(['attributesForFaceting' => ['colors', 'multiverseid']]);
$cards = $index->search($search, ['facets' => '*', 'facetFilters' => 'colors:Green'])['hits'];
foreach ($cards as $index => $card) {
if (isset($card['manaCost'])) {
$cards[$index]['manaCost'] = preg_replace('/{(.)}/', '<img src="/images/blank.png" id="$1" />', $card['manaCost']);
}
}
$cache->forever($search, $cards);
//}
$this->setJavascriptData(compact('cards'));
}
示例6: forever
/**
* Store an item in the cache indefinitely.
*
* @param string $key
* @param mixed $value
* @return void
* @static
*/
public static function forever($key, $value)
{
\Illuminate\Cache\Repository::forever($key, $value);
}
示例7: forever
/**
* Store an item in the cache indefinitely.
*
* @param mixed $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
if (is_array($key) && is_array($value)) {
$this->foreverMany(array_combine($key, $value));
} else {
parent::forever($key, $value);
}
}
示例8: updateInverseIndex
/**
* Updates the inverse index for the given cache key.
*
* @param string $key
* @param \DateTime|int|null $minutes
*/
protected function updateInverseIndex($key, $minutes = null)
{
$this->setKeywordsOperation(true);
$keywordsState = $this->determineKeywordsState($key);
$inverseIndexKey = $this->generateInverseIndexKey($key);
if (empty($keywordsState['new'])) {
parent::forget($inverseIndexKey);
} elseif ($keywordsState['old'] != $keywordsState['new']) {
$newInverseIndex = array_values($keywordsState['new']);
is_null($minutes) ? parent::forever($inverseIndexKey, $newInverseIndex) : parent::put($inverseIndexKey, $newInverseIndex, $minutes);
}
$this->setKeywordsOperation(false);
}
示例9: updateConfigVersion
public function updateConfigVersion($version)
{
$this->cache->forever('laravel-asset-versioning.version', $version);
}
示例10: saveToCache
/**
* Save a chunk to the cache.
*
* @param type $type
* @param type $slotname
* @param type $version
* @param null|ChunkModel $chunk
*/
public function saveToCache($type, $slotname, $version, ChunkModel $chunk = null)
{
$key = $this->getCacheKey($type, $slotname, $version);
$this->cache->forever($key, $chunk);
}
示例11: forever
/**
* Store an item in the cache indefinitely.
*
* @param string $key
* @param mixed $value
*
* @return void
*/
public function forever($key, $value)
{
if ($this->enabled) {
$this->cache->forever($key, $value);
}
}
示例12: setSiteInstanceCache
/**
* setSiteInstanceCache
*
* @param string $siteKey to regenerate site instances cache
* @param InstanceRoute[] $instanceRoutes instance routes array
*
* @return void
*/
public function setSiteInstanceCache($siteKey, $instanceRoutes)
{
$keyString = $this->getSiteCacheKeyString($siteKey);
$this->cache->forever($keyString, serialize($instanceRoutes));
}