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

mokeseven7's avatar

Redis Session Driver

Hey All -

Experimenting with redis as a session driver, and seeing (what i think), is strange behavior.

.env

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=redis
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

config/session

'driver' => env('SESSION_DRIVER', 'redis'),
'connection' => 'default',

config/database:

 'redis' => [

        'client' => 'predis',

        'default' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,
        ],

    ],

When i write to the session, and look at the keys on my redis server, i get something like this:

laravel_cache:1wtsbDbRDsQyyRGp9JrehrcrrC9EcPnv5s9eT6XY

I am able to write and read from the session data via redis..

But to my understanding, the keys in redis should be pre-fixed with "laravel_session", not laravel_cache. I have not changed the cache driver from file to redis anywhere. Is this the expected behavior having only changed the session driver?

Thanks for your time.

0 likes
0 replies

Please or to participate in this conversation.