Class ReactiveRedisSessionRepository
java.lang.Object
org.springframework.session.data.redis.ReactiveRedisSessionRepository
- All Implemented Interfaces:
org.springframework.session.ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
public class ReactiveRedisSessionRepository
extends Object
implements org.springframework.session.ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
A
ReactiveSessionRepository
that is implemented using Spring Data's
ReactiveRedisOperations
.- Since:
- 2.2.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default namespace for each key and channel in Redis used by Spring Session. -
Constructor Summary
ConstructorDescriptionReactiveRedisSessionRepository
(org.springframework.data.redis.core.ReactiveRedisOperations<String, Object> sessionRedisOperations) Create a newReactiveRedisSessionRepository
instance. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
reactor.core.publisher.Mono<Void>
deleteById
(String id) reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
Returns theReactiveRedisOperations
used for sessions.reactor.core.publisher.Mono<Void>
save
(org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession session) void
setDefaultMaxInactiveInterval
(int defaultMaxInactiveInterval) Deprecated.void
setDefaultMaxInactiveInterval
(Duration defaultMaxInactiveInterval) Set the maximum inactive interval in seconds between requests before newly created sessions will be invalidated.void
setRedisKeyNamespace
(String namespace) void
setSaveMode
(org.springframework.session.SaveMode saveMode) Set the save mode.
-
Field Details
-
DEFAULT_NAMESPACE
The default namespace for each key and channel in Redis used by Spring Session.- See Also:
-
-
Constructor Details
-
ReactiveRedisSessionRepository
public ReactiveRedisSessionRepository(org.springframework.data.redis.core.ReactiveRedisOperations<String, Object> sessionRedisOperations) Create a newReactiveRedisSessionRepository
instance.- Parameters:
sessionRedisOperations
- theReactiveRedisOperations
to use for managing sessions
-
-
Method Details
-
setRedisKeyNamespace
-
setDefaultMaxInactiveInterval
Set the maximum inactive interval in seconds between requests before newly created sessions will be invalidated. A negative time indicates that the session will never time out. The default is 30 minutes.- Parameters:
defaultMaxInactiveInterval
- the default maxInactiveInterval
-
setDefaultMaxInactiveInterval
@Deprecated(since="3.0.0") public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) Deprecated.since 3.0.0, in favor ofsetDefaultMaxInactiveInterval(Duration)
Set the maximum inactive interval in seconds between requests before newly created sessions will be invalidated. A negative time indicates that the session will never time out. The default is 1800 (30 minutes).- Parameters:
defaultMaxInactiveInterval
- the default maxInactiveInterval in seconds
-
setSaveMode
public void setSaveMode(org.springframework.session.SaveMode saveMode) Set the save mode.- Parameters:
saveMode
- the save mode
-
getSessionRedisOperations
public org.springframework.data.redis.core.ReactiveRedisOperations<String,Object> getSessionRedisOperations()Returns theReactiveRedisOperations
used for sessions.- Returns:
- the
ReactiveRedisOperations
used for sessions
-
createSession
public reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession> createSession()- Specified by:
createSession
in interfaceorg.springframework.session.ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
-
save
public reactor.core.publisher.Mono<Void> save(org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession session) - Specified by:
save
in interfaceorg.springframework.session.ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
-
findById
public reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession> findById(String id) - Specified by:
findById
in interfaceorg.springframework.session.ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
-
deleteById
- Specified by:
deleteById
in interfaceorg.springframework.session.ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession>
-
setDefaultMaxInactiveInterval(Duration)