Home  >  Q&A  >  body text

php - Laravel uses redis to store sessions

The redis storage session is configured in Laravel
But the question is how to set the session to expire after a week, preferably in the early morning at night?

In addition, after the user logs out, use forget to find that the session in redis still exists

Also, how do I use sessionid to get session information from redis

给我你的怀抱给我你的怀抱2683 days ago649

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-17 09:57:24

    Question 1: How to set the session to expire after a week, preferably in the early hours of the night?
    Answer: The config/session.php中有lifetime parameter in the project root directory indicates the expiration time in minutes, more specifically until the early hours of the night. This is difficult to handle;

    Question 2: After the user logs out, use forget to find that the session in redis still exists?
    Answer: Question, take a look at your forget语句怎么写的呢?要不试试destory方法;参考参考IlluminateSessionCacheBasedSessionHandler.php code;

    Question 3: How to get session information from redis?
    Answer: read method, replace sessionId作参数传入;同样参考IlluminateSessionCacheBasedSessionHandler.php;

    reply
    0
  • Cancelreply