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:
Rob Winch
2015-04-15 15:25:50 -05:00
parent f711876347
commit 23afc1b354
3 changed files with 128 additions and 20 deletions

View File

@@ -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.