public class CTPMapSessionRepository
extends java.lang.Object
implements org.springframework.session.SessionRepository<org.springframework.session.ExpiringSession>
SessionRepository
backed by a Map
and that uses a MapSession
. By default a
ConcurrentHashMap
is used, but a custom Map
can be injected to use
distributed maps provided by NoSQL stores like Redis and Hazelcast.
The implementation does NOT support firing SessionDestroyedEvent
.
构造器和说明 |
---|
CTPMapSessionRepository()
Creates an instance backed by a
ConcurrentHashMap |
CTPMapSessionRepository(java.util.Map<java.lang.String,org.springframework.session.ExpiringSession> sessions)
Creates a new instance backed by the provided
Map . |
限定符和类型 | 方法和说明 |
---|---|
org.springframework.session.ExpiringSession |
createSession() |
void |
delete(java.lang.String id) |
org.springframework.session.ExpiringSession |
getSession(java.lang.String id) |
void |
save(org.springframework.session.ExpiringSession session) |
void |
setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
If non-null, this value is used to override
ExpiringSession.setMaxInactiveIntervalInSeconds(int) . |
public CTPMapSessionRepository()
ConcurrentHashMap
public CTPMapSessionRepository(java.util.Map<java.lang.String,org.springframework.session.ExpiringSession> sessions)
Map
. This allows injecting a distributed Map
.sessions
- the Map
to use. Cannot be null.public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
ExpiringSession.setMaxInactiveIntervalInSeconds(int)
.defaultMaxInactiveInterval
- the number of seconds that the Session
should be kept alive between client requests.public void save(org.springframework.session.ExpiringSession session)
save
在接口中 org.springframework.session.SessionRepository<org.springframework.session.ExpiringSession>
public org.springframework.session.ExpiringSession getSession(java.lang.String id)
getSession
在接口中 org.springframework.session.SessionRepository<org.springframework.session.ExpiringSession>
public void delete(java.lang.String id)
delete
在接口中 org.springframework.session.SessionRepository<org.springframework.session.ExpiringSession>
public org.springframework.session.ExpiringSession createSession()
createSession
在接口中 org.springframework.session.SessionRepository<org.springframework.session.ExpiringSession>