Ejemplo n.º 1
0
 /**
  * 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);
 }
 /**
  * {@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;
 }
 /**
  * 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;
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
Ejemplo n.º 5
0
 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'));
 }
Ejemplo n.º 6
0
 /**
  * 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);
 }
Ejemplo n.º 7
0
 /**
  * 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);
     }
 }
 /**
  * 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);
 }
 public function updateConfigVersion($version)
 {
     $this->cache->forever('laravel-asset-versioning.version', $version);
 }
Ejemplo n.º 10
0
 /**
  * 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);
 }
Ejemplo n.º 11
0
 /**
  * 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);
     }
 }
 /**
  * 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));
 }