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 Object implements org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
AReactiveSessionRepository
that is implemented using vert.x reactive postgres client.
-
-
Constructor Summary
Constructors Constructor Description ReactivePostgresSessionRepository(io.reactiverse.pgclient.PgPool pgPool, SerializationStrategy serializationStrategy, Clock clock)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Integer>
cleanupExpiredSessions()
reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
createSession()
reactor.core.publisher.Mono<Void>
deleteById(String id)
reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
findById(String id)
reactor.core.publisher.Mono<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.
-
-
-
Constructor Detail
-
ReactivePostgresSessionRepository
public ReactivePostgresSessionRepository(io.reactiverse.pgclient.PgPool pgPool, SerializationStrategy serializationStrategy, Clock clock)
Creates a new instance.- Parameters:
pgPool
- the database poolserializationStrategy
- theSerializationStrategy
to read and write session data with.clock
- theClock
to use
-
-
Method Detail
-
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<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(String id)
- Specified by:
findById
in interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
deleteById
public reactor.core.publisher.Mono<Void> deleteById(String id)
- Specified by:
deleteById
in interfaceorg.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
-
cleanupExpiredSessions
public reactor.core.publisher.Mono<Integer> cleanupExpiredSessions()
-
-