Class ReactivePostgresSessionRepository
java.lang.Object
net.andreaskluth.session.postgres.ReactivePostgresSessionRepository
- All Implemented Interfaces:
org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
public class ReactivePostgresSessionRepository
extends java.lang.Object
implements org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
A
ReactiveSessionRepository
that is implemented using vert.x reactive postgres client.-
Constructor Summary
Constructors Constructor Description ReactivePostgresSessionRepository(io.vertx.sqlclient.Pool pool, SerializationStrategy serializationStrategy, java.time.Clock clock)
Creates a new instance. -
Method Summary
Modifier and Type Method Description reactor.core.publisher.Mono<java.lang.Integer>
cleanupExpiredSessions()
reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
createSession()
reactor.core.publisher.Mono<java.lang.Void>
deleteById(java.lang.String id)
reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
findById(java.lang.String id)
reactor.core.publisher.Mono<java.lang.Void>
save(net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession postgresSession)
void
setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
Sets the maximum inactive interval in seconds between requests before newly created sessions will be invalidated.void
setSequenceName(java.lang.String sequenceName)
Set a custom sequence name used for metrics seeMono.name(String)
.void
withMetrics(boolean enableMetrics)
ActivatesMono.metrics()
for all operations.
-
Constructor Details
-
ReactivePostgresSessionRepository
public ReactivePostgresSessionRepository(io.vertx.sqlclient.Pool pool, SerializationStrategy serializationStrategy, java.time.Clock clock)Creates a new instance.- Parameters:
pool
- the database poolserializationStrategy
- theSerializationStrategy
to read and write session data with.clock
- theClock
to use
-
-
Method Details
-
withMetrics
public void withMetrics(boolean enableMetrics)ActivatesMono.metrics()
for all operations.- Parameters:
enableMetrics
- whether metrics should be generated or not.
-
setSequenceName
public void setSequenceName(java.lang.String sequenceName)Set a custom sequence name used for metrics seeMono.name(String)
.- Parameters:
sequenceName
- overrides the default sequence name
-
setDefaultMaxInactiveInterval
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)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. The default is 1800 (30 minutes).- Parameters:
defaultMaxInactiveInterval
- the number of seconds that theSession
should be kept alive between client requests.
-
createSession
public reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> createSession()- Specified by:
createSession
in interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
save
public reactor.core.publisher.Mono<java.lang.Void> save(net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession postgresSession)- Specified by:
save
in interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
findById
public reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> findById(java.lang.String id)- Specified by:
findById
in interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
deleteById
public reactor.core.publisher.Mono<java.lang.Void> deleteById(java.lang.String id)- Specified by:
deleteById
in interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
cleanupExpiredSessions
public reactor.core.publisher.Mono<java.lang.Integer> cleanupExpiredSessions()
-