spring-session
spring-session copied to clipboard
After `changeSessionId`, expirationStore(ordered set) lost the new sessionId
Describe the bug
After changeSessionId, expirationStore(ordered set) lost the new sessionId
To Reproduce
- config
SortedSetRedisSessionExpirationStorefor expirationStore - Create a new session and save it
- FindById to get the previously saved session
- Call changeSessionId and save it
- You can see in the
expirationkv of redis that the new sessionId does not exist
Expected behavior
The old sessionId should be deleted and the new sessionId should be appended to the sorted set of redis
Source
https://github.com/spring-projects/spring-session/blob/2353d8b3cec4f0ed104c45f10d01acf278fe1dad/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisIndexedSessionRepository.java#L994
How to fix
We can add a rename method to the RedisSessionExpirationStore interface
rename(String oldSessionId, String newSessionId, Integer expirationInMillis)