diff --git a/src/main/java/org/springframework/session/redis/RedisOperationsSessionRepository.java b/src/main/java/org/springframework/session/redis/RedisOperationsSessionRepository.java index 5957e035..05d09386 100644 --- a/src/main/java/org/springframework/session/redis/RedisOperationsSessionRepository.java +++ b/src/main/java/org/springframework/session/redis/RedisOperationsSessionRepository.java @@ -39,11 +39,23 @@ public class RedisOperationsSessionRepository implements SessionRepository redisTemplate; + private Integer defaultMaxInactiveInterval; + public RedisOperationsSessionRepository(RedisOperations redisTemplate) { this.redisTemplate = redisTemplate; } - @Override + /** + * Sets the maximum inactive interval in seconds between requests before newly created sessions will be + * invalidated. A negative time indicates that the session will never timeout. + * + * @param defaultMaxInactiveInterval the number of seconds that the {@link Session} should be kept alive between client requests. + */ + public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) { + this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; + } + + @Override public void save(RedisSession session) { session.saveDelta(); } @@ -79,7 +91,11 @@ public class RedisOperationsSessionRepository implements SessionRepository