/** * 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); }
/** * {@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(); }
/** * @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; }
/** * 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); } }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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.'); }
/** * Completely flush the cache * * @param string $locale * @param string $group * @param string $namespace * @return void */ public function flushAll() { $this->store->flush(); }
/** * Clear the cache * * @return void */ public function clear() { $this->store->flush(); }
/** * 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]); }
/** * Get the cache key prefix. * * @return string */ public function getPrefix() { return $this->store->getPrefix(); }
/** * 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; }
/** * 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; }
/** * 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)); }
/** * {@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()); }