Package org.springframework.session
Interface SessionRepository<S extends Session>
- Type Parameters:
S
- theSession
type
- All Known Subinterfaces:
FindByIndexNameSessionRepository<S>
- All Known Implementing Classes:
HazelcastIndexedSessionRepository
,HazelcastSessionRepository
,JdbcIndexedSessionRepository
,JdbcOperationsSessionRepository
,MapSessionRepository
,MongoIndexedSessionRepository
,MongoOperationsSessionRepository
,RedisIndexedSessionRepository
,RedisOperationsSessionRepository
,RedisSessionRepository
public interface SessionRepository<S extends Session>
A repository interface for managing
Session
instances.- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newSession
that is capable of being persisted by thisSessionRepository
.void
deleteById
(String id) void
Ensures theSession
created bycreateSession()
is saved.
-
Method Details
-
createSession
S createSession()Creates a newSession
that is capable of being persisted by thisSessionRepository
.This allows optimizations and customizations in how the
Session
is persisted. For example, the implementation returned might keep track of the changes ensuring that only the delta needs to be persisted on a save.- Returns:
- a new
Session
that is capable of being persisted by thisSessionRepository
-
save
Ensures theSession
created bycreateSession()
is saved.Some implementations may choose to save as the
Session
is updated by returning aSession
that immediately persists any changes. In this case, this method may not actually do anything.- Parameters:
session
- theSession
to save
-
findById
- Parameters:
id
- theSession.getId()
to lookup- Returns:
- the
Session
by theSession.getId()
or null if noSession
is found.
-
deleteById
- Parameters:
id
- theSession.getId()
to delete
-