Fix RedisSessionExpirationPolicy to properly cleanup expired sessions
Previously forcibly cleaning up sessions was not working. All the cleanup was done by Redis expiration. This meant that sessions would be kept alive until Redis cleaned them up (non deterministic). This commit resolves the mapping of expiration to session ids. Fixes gh-169
This commit is contained in:
@@ -333,7 +333,7 @@ This allows a background task to access the potentially expired sessions to ensu
|
||||
For example:
|
||||
|
||||
SADD spring:session:expirations:<expire-rounded-up-to-nearest-minute> <session-id>
|
||||
EXPIRE spring:session:expirations:<expire-rounded-up-to-nearest-minute> 1800
|
||||
EXPIRE spring:session:expirations:<expire-rounded-up-to-nearest-minute> 1860
|
||||
|
||||
The background task will then use these mappings to explicitly request each key.
|
||||
By accessing they key, rather than deleting it, we ensure that Redis deletes the key for us only if the TTL is expired.
|
||||
|
||||
Reference in New Issue
Block a user