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
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
;