Exemplo n.º 1
0
 /**
  * Return the cache instance with tags attached.
  *
  * @return \Illuminate\Contracts\Cache\Repository|\Illuminate\Contracts\Cache\Store
  */
 protected function cache()
 {
     if (!method_exists($this->cache, 'tags')) {
         return $this->cache;
     }
     return $this->cache->tags($this->tag);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function fire()
 {
     $this->info('Clearing the cache...');
     $this->forum->getAssets()->flush();
     $this->admin->getAssets()->flush();
     $this->cache->flush();
 }
 /**
  * {@inheritdoc}
  */
 protected function clearOneObjectFromCache($key)
 {
     if (null === $this->store->get($key)) {
         return true;
     }
     return $this->store->forget($key);
 }
 /**
  * Handle the command.
  *
  * @param Rollback $command
  */
 public function handle(Rollback $command)
 {
     $migration = $command->getMigration();
     $migration->unassignFields();
     $migration->deleteStream();
     $migration->deleteFields();
     $this->cache->flush();
 }
Exemplo n.º 5
0
 /**
  * @param UrlGenerator $url
  * @param Store        $cache
  * @param null         $publicFolder
  */
 public function __construct(UrlGenerator $url, Store $cache, $publicFolder = null)
 {
     $this->url = $url;
     $this->cache = $cache;
     if (method_exists($this->cache, 'tags')) {
         $this->cache = $cache->tags('arrounded.meta');
     }
     $this->publicFolder = $publicFolder;
 }
Exemplo n.º 6
0
 /**
  * Store the cache.
  *
  * @return void
  */
 public function save()
 {
     $contents = $this->getForStorage();
     if ($this->ttl !== null) {
         $this->client->put($this->key, $contents, $this->ttl);
     } else {
         $this->client->forever($this->key, $contents);
     }
 }
Exemplo n.º 7
0
 /**
  * Clear the cache for the given user.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $user
  * @return $this
  */
 public function refreshFor(Model $user)
 {
     $id = $user->getKey();
     $this->cache->forget($this->tag . '-abilities-' . $id);
     $this->cache->forget($this->tag . '-roles-' . $id);
     return $this;
 }
Exemplo n.º 8
0
 /**
  * Clear the cache for the given user.
  *
  * @param  \Illuminate\Database\Eloquent\Model|int  $user
  * @return $this
  */
 public function refreshFor($user)
 {
     $id = $user instanceof Model ? $user->getKey() : $user;
     $this->cache->forget($this->tag . '-permissions-' . $id);
     $this->cache->forget($this->tag . '-roles-' . $id);
     return $this;
 }
Exemplo n.º 9
0
 /**
  * Clear the cache for the given authority.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $authority
  * @return $this
  */
 public function refreshFor(Model $authority)
 {
     $this->cache->forget($this->getCacheKey($authority, 'abilities', true));
     $this->cache->forget($this->getCacheKey($authority, 'abilities', false));
     $this->cache->forget($this->getCacheKey($authority, 'roles'));
     return $this;
 }
Exemplo n.º 10
0
 /**
  * Get the throttle hit count.
  *
  * @return int
  */
 public function count()
 {
     if ($this->number !== null) {
         return $this->number;
     }
     $this->number = (int) $this->store->get($this->key);
     if (!$this->number) {
         $this->number = 0;
     }
     return $this->number;
 }
Exemplo n.º 11
0
 /**
  * Begin executing a new tags operation if the store supports it.
  *
  * @param array|mixed $names        	
  * @return \Illuminate\Cache\TaggedCache
  *
  * @throws \BadMethodCallException
  */
 public function tags($names)
 {
     if (method_exists($this->store, 'tags')) {
         $taggedCache = $this->store->tags($names);
         if (!is_null($this->events)) {
             $taggedCache->setEventDispatcher($this->events);
         }
         $taggedCache->setDefaultCacheTime($this->default);
         return $taggedCache;
     }
     throw new BadMethodCallException('This cache store does not support tagging.');
 }
Exemplo n.º 12
0
 /**
  *  Completely flush the cache
  *
  *  @param  string  $locale
  *  @param  string  $group
  *  @param  string  $namespace
  *  @return void
  */
 public function flushAll()
 {
     $this->store->flush();
 }
Exemplo n.º 13
0
 /**
  *  Clear the cache
  *
  *  @return void
  */
 public function clear()
 {
     $this->store->flush();
 }
Exemplo n.º 14
0
 /**
  *  Completely clear the cache
  *
  *  @return void
  */
 public function clear()
 {
     $this->store->tags([$this->cacheTag])->flush();
 }
 /**
  * Store an item in the cache indefinitely.
  *
  * @param  string  $key
  * @param  mixed   $value
  * @return void
  */
 public function forever($key, $value)
 {
     $this->store->forever($key, $value);
     $this->fireCacheEvent('write', [$key, $value, 0]);
 }
Exemplo n.º 16
0
 /**
  * Get the cache key prefix.
  *
  * @return string
  */
 public function getPrefix()
 {
     return $this->store->getPrefix();
 }
Exemplo n.º 17
0
 /**
  * Reset the tag and return the new tag identifier.
  *
  * @param string $name        	
  * @return string
  */
 public function resetTag($name)
 {
     $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true)));
     return $id;
 }
Exemplo n.º 18
0
 /**
  * Remove an item from the cache.
  *
  * @param  string $key
  * @return bool
  */
 public function forget($key)
 {
     $success = $this->store->forget($key);
     $this->fireCacheEvent('delete', [$key]);
     return $success;
 }
Exemplo n.º 19
0
 /**
  * Clear the login locks for the given user credentials.
  * @param  Request  $request
  * @return void
  */
 protected function clearLoginAttempts(Request $request, Cache $cache)
 {
     $cache->forget($this->loginAttemptsKey($request));
     $cache->forget($this->loginLockExpirationKey($request));
 }
Exemplo n.º 20
0
 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     $this->cache->flush();
     // Impossible to determine if the flush was successful.
 }
 /**
  * Get a query builder for the cache table.
  *
  * @return \Illuminate\Database\Query\Builder
  */
 protected function table()
 {
     return $this->store->getConnection()->table($this->store->getTable());
 }