@Singleton @Primary public class InMemorySessionStore extends Object implements SessionStore<InMemorySession>
Constructor and Description |
---|
InMemorySessionStore(SessionIdGenerator sessionIdGenerator,
SessionConfiguration sessionConfiguration,
ApplicationEventPublisher eventPublisher)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Boolean> |
deleteSession(String id)
Delete a session for the given ID.
|
CompletableFuture<Optional<InMemorySession>> |
findSession(String id)
Find a session for the given ID.
|
InMemorySession |
newSession()
Create a new unsaved session.
|
protected com.github.benmanes.caffeine.cache.Cache<String,InMemorySession> |
newSessionCache(SessionConfiguration configuration)
Creates a new session cache.
|
CompletableFuture<InMemorySession> |
save(InMemorySession session)
Save the given session.
|
public InMemorySessionStore(SessionIdGenerator sessionIdGenerator, SessionConfiguration sessionConfiguration, ApplicationEventPublisher eventPublisher)
sessionIdGenerator
- The session id generatorsessionConfiguration
- The sessions configurationeventPublisher
- The application event publisherpublic InMemorySession newSession()
SessionStore
newSession
in interface SessionStore<InMemorySession>
public CompletableFuture<Optional<InMemorySession>> findSession(String id)
SessionStore
findSession
in interface SessionStore<InMemorySession>
id
- The ID of the sessionOptional
sessionpublic CompletableFuture<Boolean> deleteSession(String id)
SessionStore
deleteSession
in interface SessionStore<InMemorySession>
id
- The ID of the sessionpublic CompletableFuture<InMemorySession> save(InMemorySession session)
SessionStore
save
in interface SessionStore<InMemorySession>
session
- The session to saveprotected com.github.benmanes.caffeine.cache.Cache<String,InMemorySession> newSessionCache(SessionConfiguration configuration)
configuration
- The session configuration