spring-framework / org.springframework.web.server.session / InMemoryWebSessionStore

InMemoryWebSessionStore

open class InMemoryWebSessionStore : WebSessionStore

Simple Map-based storage for WebSession instances.

Author
Rossen Stoyanchev

Author
Rob Winch

Since
5.0

Constructors

<init>

InMemoryWebSessionStore()

Simple Map-based storage for WebSession instances.

Functions

createWebSession

open fun createWebSession(): Mono<WebSession>

getClock

open fun getClock(): Clock

Return the configured clock for session lastAccessTime calculations.

removeSession

open fun removeSession(id: String): Mono<Void>

retrieveSession

open fun retrieveSession(id: String): Mono<WebSession>

setClock

open fun setClock(clock: Clock): Unit

Configure the Clock to use to set lastAccessTime on every created session and to calculate if it is expired.

This may be useful to align to different timezone or to set the clock back in a test, e.g. Clock.offset(clock, Duration.ofMinutes(-31)) in order to simulate session expiration.

By default this is Clock.system(ZoneId.of("GMT")).

updateLastAccessTime

open fun updateLastAccessTime(webSession: WebSession): Mono<WebSession>