Redis save does nothing if nothing has changed

Fixes gh-467
This commit is contained in:
Rob Winch
2016-04-06 13:22:13 -05:00
parent 61b01d9ecd
commit 7c616a1adf
2 changed files with 15 additions and 1 deletions

View File

@@ -771,6 +771,9 @@ public class RedisOperationsSessionRepository implements
* session.
*/
private void saveDelta() {
if (this.delta.isEmpty()) {
return;
}
String sessionId = getId();
getSessionBoundHashOperations(sessionId).putAll(this.delta);
String principalSessionKey = getSessionAttrNameKey(
@@ -781,7 +784,7 @@ public class RedisOperationsSessionRepository implements
|| this.delta.containsKey(securityPrincipalSessionKey)) {
if (this.originalPrincipalName != null) {
String originalPrincipalRedisKey = getPrincipalKey(
(String) this.originalPrincipalName);
this.originalPrincipalName);
RedisOperationsSessionRepository.this.sessionRedisOperations
.boundSetOps(originalPrincipalRedisKey).remove(sessionId);
}