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)voidsetDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)Sets the maximum inactive interval in seconds between requests before newly created sessions will be invalidated.voidsetSequenceName(java.lang.String sequenceName)Set a custom sequence name used for metrics seeMono.name(String).voidwithMetrics(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- theSerializationStrategyto read and write session data with.clock- theClockto 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 theSessionshould be kept alive between client requests.
-
createSession
public reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> createSession()- Specified by:
createSessionin 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:
savein 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:
findByIdin 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:
deleteByIdin interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
cleanupExpiredSessions
public reactor.core.publisher.Mono<java.lang.Integer> cleanupExpiredSessions()
-