have you installed the required package?
Jan 5, 2018
4
Level 13
Redis working, but can't use Cache::store('redis')
I have successfully installed Redis and verified that it's working with following-
Redis::set('name', 'Jack');
$getName = Redis::get('name') // Returns 'Jack'
However, when I use -
Cache::store('redis')->put('name', 'Jack', 1);
$getName = Cache::store('redis')->get('name');
I get following error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Class 'League\Flysystem\Cached\Storage\AbstractCache' not found
My Configuration --
Config/database.php :
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
and Config/cache.php :
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
My best guess is that the redis setup inside Config/cache.php isn't complete. Can someone have a look and let me know?
Level 13
Update:
It looked like it needed the following :
php artisan config:clear
php artisan cache:clear
composer dump-autoload
valet restart
Seems to be working fine now! :-)
3 likes
Please or to participate in this conversation.