public class ReactiveRedisSessionRepository extends java.lang.Object implements ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.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 |
---|
ReactiveRedisSessionRepository(org.springframework.data.redis.core.ReactiveRedisOperations<java.lang.String,java.lang.Object> sessionRedisOperations)
Create a new
ReactiveRedisSessionRepository instance. |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.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.ReactiveRedisSessionRepository.RedisSession> |
findById(java.lang.String id)
|
org.springframework.data.redis.core.ReactiveRedisOperations<java.lang.String,java.lang.Object> |
getSessionRedisOperations()
Returns the
ReactiveRedisOperations used for sessions. |
reactor.core.publisher.Mono<java.lang.Void> |
save(org.springframework.session.data.redis.ReactiveRedisSessionRepository.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 |
setRedisKeyNamespace(java.lang.String namespace) |
void |
setSaveMode(SaveMode saveMode)
Set the save mode.
|
public static final java.lang.String DEFAULT_NAMESPACE
public ReactiveRedisSessionRepository(org.springframework.data.redis.core.ReactiveRedisOperations<java.lang.String,java.lang.Object> sessionRedisOperations)
ReactiveRedisSessionRepository
instance.sessionRedisOperations
- the ReactiveRedisOperations
to use for
managing sessionspublic 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 setSaveMode(SaveMode saveMode)
saveMode
- the save modepublic org.springframework.data.redis.core.ReactiveRedisOperations<java.lang.String,java.lang.Object> getSessionRedisOperations()
ReactiveRedisOperations
used for sessions.ReactiveRedisOperations
used for sessionspublic reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.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.ReactiveRedisSessionRepository.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.ReactiveRedisSessionRepository.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.ReactiveRedisSessionRepository.RedisSession>
session
- the Session
to savepublic reactor.core.publisher.Mono<org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession> findById(java.lang.String id)
ReactiveSessionRepository
findById
in interface ReactiveSessionRepository<org.springframework.session.data.redis.ReactiveRedisSessionRepository.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.ReactiveRedisSessionRepository.RedisSession>
id
- the Session.getId()
to delete