public class HazelcastSessionRepository extends Object implements SessionRepository<com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession>
SessionRepository implementation that stores
sessions in Hazelcast's distributed IMap.
An example of how to create a new instance can be seen below:
Config config = new Config();
// ... configure Hazelcast ...
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
IMap<String, MapSession> sessions = hazelcastInstance
.getMap("spring:session:sessions");
HazelcastSessionRepository sessionRepository =
new HazelcastSessionRepository(sessions);
| Constructor and Description |
|---|
HazelcastSessionRepository() |
| Modifier and Type | Method and Description |
|---|---|
com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession |
createSession() |
void |
deleteById(String id) |
com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession |
findById(String id) |
Map<String,MapSession> |
getSessions() |
void |
save(com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession session) |
void |
setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
Set the maximum inactive interval in seconds between requests before newly created
sessions will be invalidated.
|
void |
setHazelcastFlushMode(HazelcastFlushMode hazelcastFlushMode)
Sets the Hazelcast flush mode.
|
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
defaultMaxInactiveInterval - the maximum inactive interval in secondspublic void setHazelcastFlushMode(HazelcastFlushMode hazelcastFlushMode)
HazelcastFlushMode.ON_SAVE.hazelcastFlushMode - the new Hazelcast flush modepublic com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession createSession()
createSession in interface SessionRepository<com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession>public void save(com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession session)
save in interface SessionRepository<com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession>public com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession findById(String id)
findById in interface SessionRepository<com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession>public void deleteById(String id)
deleteById in interface SessionRepository<com.networknt.session.hazelcast.HazelcastSessionRepository.HazelcastSession>public Map<String,MapSession> getSessions()
Copyright © 2021. All rights reserved.