Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thebigk's avatar
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?

0 likes
4 replies
shez1983's avatar

have you installed the required package?

thebigk's avatar
Level 13

Yes, as I said I can save data to Redis and retrieve it. The cache however returns error.

oaj's avatar

Have you tried

composer dumpautoload
thebigk's avatar
thebigk
OP
Best Answer
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.