/** * Verify the existence of the given user token. * * @param string $token * * @return \Fahita\Contracts\UserInterface|null */ public function loginWithToken($token) { if ($this->verifyToken($token)) { $id = $this->cache->get($this->getCacheKey($token)); $attributes = $this->redis->hgetall('users:' . $id); $user = (new User())->newInstance($attributes, true); // creating a new instance does not include the record id // but we want it, so we force fill it to fulfill it. $user->forceFill($attributes); return $this->login($user); } }
/** * Create an instance of the Redis cache driver. * * @param array $config * * @return \Illuminate\Cache\RedisStore|\Illuminate\Cache\FileStore */ protected function createRedisDriver(array $config) { $redis = $this->app['redis']; $connection = \Illuminate\Support\Arr::get($config, 'connection', 'default') ?: 'default'; $store = new RedisStore($redis, $this->getPrefix($config), $connection); try { $store->getRedis()->ping(); return $this->repository($store); } catch (Exception $e) { event('redis.unavailable', null); return parent::createFileDriver(\Config::get('cache.stores.file')); } }
/** * Set the cache key prefix. * * @param string $prefix * @return void * @static */ public static function setPrefix($prefix) { \Illuminate\Cache\RedisStore::setPrefix($prefix); }
/** * {@inheritdoc} */ protected function doGetStats() { $stats = $this->store->connection()->info(); return [Cache::STATS_HITS => isset($stats['keyspace_hits']) ? $stats['keyspace_hits'] : $stats['Stats']['keyspace_hits'], Cache::STATS_MISSES => isset($stats['keyspace_misses']) ? $stats['keyspace_misses'] : $stats['Stats']['keyspace_misses'], Cache::STATS_UPTIME => isset($stats['uptime_in_seconds']) ? $stats['uptime_in_seconds'] : $stats['Server']['uptime_in_seconds'], Cache::STATS_MEMORY_USAGE => isset($stats['used_memory']) ? $stats['used_memory'] : $stats['Memory']['used_memory']]; }
/** * Begin executing a new tags operation. * * @param string $name * @return \Illuminate\Cache\TaggedCache * @static */ public static function section($name) { //Method inherited from \Illuminate\Cache\TaggableStore return \Illuminate\Cache\RedisStore::section($name); }
public function __construct(RedisStore $redis) { $this->redis = $redis; $this->client = $redis->connection(); }
/** * Remove all items from the cache. * * @return void */ public function flush() { $isCluster = config('database.redis.cluster'); if (!$isCluster) { parent::flush(); } }
public function __construct(Cache $cache, RedisStore $redis) { $this->cache = $cache; $this->redis = $redis->connection(); }
/** * Get a pipeline instance. * * @return \Predis\Pipeline\PipelineContext */ public function pipeline() { return $this->store->pipeline(); }
/** * @param $tags * * @return void */ public function flush($tags) { return $this->cache->tags($tags)->flush(); }