Class RedisSessionRepository

  • All Implemented Interfaces:
    SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>

    public class RedisSessionRepository
    extends Object
    implements SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
    A SessionRepository implementation that stores sessions in Redis repository.
    • Field Detail

      • config

        public static org.redisson.config.Config config
    • Constructor Detail

      • RedisSessionRepository

        public RedisSessionRepository()
    • 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 is RedisFlushMode.ON_SAVE.
        Parameters:
        redisFlushMode - the new Redis flush mode
      • createSession

        public com.networknt.session.redis.RedisSessionRepository.RedisSession createSession()
        Specified by:
        createSession in interface SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
      • save

        public void save​(com.networknt.session.redis.RedisSessionRepository.RedisSession session)
        Specified by:
        save in interface SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
      • findById

        public com.networknt.session.redis.RedisSessionRepository.RedisSession findById​(String id)
        Specified by:
        findById in interface SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>
      • deleteById

        public void deleteById​(String id)
        Specified by:
        deleteById in interface SessionRepository<com.networknt.session.redis.RedisSessionRepository.RedisSession>