Class TokenRedisClient

    • Constructor Detail

      • TokenRedisClient

        public TokenRedisClient​(String host,
                                int port)
    • Method Detail

      • set

        public String set​(String key,
                          long seconds,
                          String value)
        Specified by:
        set in interface TokenClient
        Parameters:
        key - the token
        seconds - for absolute timeout
        value - representation of expiration
        Returns:
        the persistence response
      • set

        public String set​(String key,
                          String value)
        Specified by:
        set in interface TokenClient
        Parameters:
        key - the token
        value - representation of expiration
        Returns:
        the persistence response
      • setKeepTTL

        public String setKeepTTL​(String key,
                                 String value)
        Description copied from interface: TokenClient
        Used to postpone expiration but keep existing absolute timeout
        Specified by:
        setKeepTTL in interface TokenClient
        Parameters:
        key - the token
        value - representation of expiration
        Returns:
        the persistence response
      • get

        public String get​(String key)
        Description copied from interface: TokenClient
        retrieve expiration from persistence
        Specified by:
        get in interface TokenClient
        Parameters:
        key - the token
        Returns:
        expiration or null if token doesn't exist
      • ttl

        public Long ttl​(String key)
        Description copied from interface: TokenClient
        retrieve the absolute timeout of token in seconds
        Specified by:
        ttl in interface TokenClient
        Parameters:
        key - the token to determine ttl for
        Returns:
        the ttl for the token
      • del

        public void del​(String... keys)
        Specified by:
        del in interface TokenClient
        Parameters:
        keys - the tokens to be removed from persistence