Package org.springframework.session
Interface SessionRepository<S extends Session>
- Type Parameters:
S- theSessiontype
- 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 newSessionthat is capable of being persisted by thisSessionRepository.voiddeleteById(String id) voidEnsures theSessioncreated bycreateSession()is saved.
-
Method Details
-
createSession
S createSession()Creates a newSessionthat is capable of being persisted by thisSessionRepository.This allows optimizations and customizations in how the
Sessionis 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
Sessionthat is capable of being persisted by thisSessionRepository
-
save
Ensures theSessioncreated bycreateSession()is saved.Some implementations may choose to save as the
Sessionis updated by returning aSessionthat immediately persists any changes. In this case, this method may not actually do anything.- Parameters:
session- theSessionto save
-
findById
- Parameters:
id- theSession.getId()to lookup- Returns:
- the
Sessionby theSession.getId()or null if noSessionis found.
-
deleteById
- Parameters:
id- theSession.getId()to delete
-