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

Tawheedyahya's avatar

Laravel Cache facade not storing data in Redis

Hi everyone šŸ‘‹ I’m facing an issue with Laravel cache and Redis. Here are the details: OS: Ubuntu PHP: PHP 8.3 Laravel: 12 Redis: installed via apt and also tested with Docker

Redis PHP extension: php-redis installed

What I did:

Set Redis as cache store in .env: CACHE_STORE=redis REDIS_HOST=127.0.0.1 REDIS_PORT=6379

Cleared config cache: php artisan optimize:clear

Verified in Tinker: config('cache.default'); // returns "redis"

The problem:

Using the Redis facade works: Redis::set('test', 'ok');

But the Cache facade does not store anything: Cache::put('name', 'yahi', 300); Cache::get('name'); // returns value, but key not visible in redis

I use jwt/tymon To generate token but go to dashboard token not provided

0 likes
2 replies
JussiMannisto's avatar

There are a couple of things to note. First, Laravel doesn't store cache records to Redis with that exact key. It'll add a prefix to avoid key collisions. That prefix is defined in the config files.

Secondly, cache records are stored in their own Redis database by default. Check the Redis section of the database.php configuration file and look for the REDIS_CACHE_DB entry. If you connect to Redis via redis-cli, you first have to switch to that DB before you see the keys:

redis-cli
> auth [your password]
> select 1
> keys *

If the cache is in DB index 1, you should see your cache keys there.

Please or to participate in this conversation.