Created
December 5, 2017 14:46
-
-
Save odedia/573241f11b1cf63c45f0dca69cfc0318 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void cleanExpiredSessions() { | |
| long now = System.currentTimeMillis(); | |
| long prevMin = roundDownMinute(now); | |
| if (logger.isDebugEnabled()) { | |
| logger.debug("Cleaning up sessions expiring at " + new Date(prevMin)); | |
| } | |
| String expirationKey = getExpirationKey(prevMin); | |
| Set<Object> sessionsToExpire = this.redis.boundSetOps(expirationKey).members(); | |
| this.redis.delete(expirationKey); | |
| for (Object session : sessionsToExpire) { | |
| String sessionKey = getSessionKey((String) session); | |
| touch(sessionKey); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment