jeudi 21 novembre 2019

Session lifetime is not applied when using Redis

I have installed redis-server on my ubuntu server. The command sudo systemctl status redis shows me that its running:

Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Mi 2019-11-20 18:50:17 CET; 23h ago

In my redis.conf I have set port and bind like this:

port 6379
bind 127.0.0.1

I have not set a password, because there are no other user with access to my server.

Here is the relevant part of my .env setting:

CACHE_DRIVER=redis
SESSION_DRIVER=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

In config/session.php I set the session lifetime to a week

'lifetime' => 60 * 24 * 7 , // Set session lifetime to a week

However, since I changed from file to redis, a session is only valid for 20 minutes or so.

How can I check if my Laravel application is correctly connected to redis? What could be the cause for the reduced lifetime of my sessions?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire