Package com.networknt.session.redis
Class RedisSessionRepository
- java.lang.Object
-
- com.networknt.session.redis.RedisSessionRepository
-
- All Implemented Interfaces:
SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
public class RedisSessionRepository extends Object implements SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
ASessionRepositoryimplementation that stores sessions in Redis repository.
-
-
Field Summary
Fields Modifier and Type Field Description static org.redisson.config.Configconfig
-
Constructor Summary
Constructors Constructor Description RedisSessionRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.networknt.session.redis.RedisSessionRepository.RedisSessioncreateSession()voiddeleteById(String id)com.networknt.session.redis.RedisSessionRepository.RedisSessionfindById(String id)Map<String,MapSession>getSessions()voidsave(com.networknt.session.redis.RedisSessionRepository.RedisSession session)voidsetDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)Set the maximum inactive interval in seconds between requests before newly created sessions will be invalidated.voidsetRedisFlushMode(RedisFlushMode redisFlushMode)Sets the Hazelcast flush mode.
-
-
-
Method Detail
-
setDefaultMaxInactiveInterval
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval)
Set the maximum inactive interval in seconds between requests before newly created sessions will be invalidated. A negative time indicates that the session will never timeout. The default is 1800 (30 minutes).- Parameters:
defaultMaxInactiveInterval- the maximum inactive interval in seconds
-
setRedisFlushMode
public void setRedisFlushMode(RedisFlushMode redisFlushMode)
Sets the Hazelcast flush mode. Default flush mode isRedisFlushMode.ON_SAVE.- Parameters:
redisFlushMode- the new Redis flush mode
-
createSession
public com.networknt.session.redis.RedisSessionRepository.RedisSession createSession()
- Specified by:
createSessionin interfaceSessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
-
save
public void save(com.networknt.session.redis.RedisSessionRepository.RedisSession session)
- Specified by:
savein interfaceSessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
-
findById
public com.networknt.session.redis.RedisSessionRepository.RedisSession findById(String id)
- Specified by:
findByIdin interfaceSessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
-
deleteById
public void deleteById(String id)
- Specified by:
deleteByIdin interfaceSessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
-
getSessions
public Map<String,MapSession> getSessions()
-
-