public class ReactiveRedisOperationsSessionRepository extends java.lang.Object implements ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession>
ReactiveSessionRepository
that is implemented using Spring Data's
ReactiveRedisOperations
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_NAMESPACE
The default namespace for each key and channel in Redis used by Spring Session.
|
Constructor and Description |
---|
ReactiveRedisOperationsSessionRepository(org.springframework.data.redis.core.ReactiveRedisOperations<java.lang.String,java.lang.Object> sessionRedisOperations) |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession> |
createSession()
Creates a new
Session that is capable of being persisted by this
ReactiveSessionRepository . |
reactor.core.publisher.Mono<java.lang.Void> |
deleteById(java.lang.String id)
|
reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession> |
findById(java.lang.String id)
|
reactor.core.publisher.Mono<java.lang.Void> |
save(org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession session)
Ensures the
Session created by
ReactiveSessionRepository.createSession() is saved. |
void |
setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
Sets the maximum inactive interval in seconds between requests before newly created
sessions will be invalidated.
|
void |
setRedisFlushMode(RedisFlushMode redisFlushMode)
Sets the redis flush mode.
|
void |
setRedisKeyNamespace(java.lang.String namespace) |
public static final java.lang.String DEFAULT_NAMESPACE
public ReactiveRedisOperationsSessionRepository(org.springframework.data.redis.core.ReactiveRedisOperations<java.lang.String,java.lang.Object> sessionRedisOperations)
public void setRedisKeyNamespace(java.lang.String namespace)
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
defaultMaxInactiveInterval
- the number of seconds that the Session
should be kept alive between client requests.public void setRedisFlushMode(RedisFlushMode redisFlushMode)
RedisFlushMode.ON_SAVE
.redisFlushMode
- the new redis flush modepublic reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession> createSession()
ReactiveSessionRepository
Session
that is capable of being persisted by this
ReactiveSessionRepository
.
This allows optimizations and customizations in how the Session
is
persisted. For example, the implementation returned might keep track of the changes
ensuring that only the delta needs to be persisted on a save.
createSession
in interface ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession>
Session
that is capable of being persisted by this
ReactiveSessionRepository
public reactor.core.publisher.Mono<java.lang.Void> save(org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession session)
ReactiveSessionRepository
Session
created by
ReactiveSessionRepository.createSession()
is saved.
Some implementations may choose to save as the Session
is updated by
returning a Session
that immediately persists any changes. In this case,
this method may not actually do anything.
save
in interface ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession>
session
- the Session
to savepublic reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession> findById(java.lang.String id)
ReactiveSessionRepository
findById
in interface ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession>
id
- the Session.getId()
to lookupSession
by the Session.getId()
or null if no
Session
is found.public reactor.core.publisher.Mono<java.lang.Void> deleteById(java.lang.String id)
ReactiveSessionRepository
deleteById
in interface ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository.RedisSession>
id
- the Session.getId()
to delete