Interface IntegerResultHandler


public interface IntegerResultHandler
Handler for Redis commands that return a RESP Integer (:).

Integers are signed 64-bit values used for counts, lengths, and boolean-like results (where 0 means false and non-zero means true) (RESP spec — "Integers").

Commands returning integers:

  • INCR / DECR - returns new value
  • LPUSH / RPUSH - returns list length
  • SADD / SREM - returns count of elements added/removed
  • DEL - returns count of keys deleted
  • EXISTS - returns count of existing keys (0 or 1 for single key)
  • SETNX - returns 1 if set, 0 if key existed
  • EXPIRE - returns 1 if timeout set, 0 if key doesn't exist
  • TTL - returns seconds until expiry, or negative if no expiry/not found
  • LLEN - returns list length
  • SCARD - returns set cardinality
  • PUBLISH - returns number of subscribers who received the message
Author:
Chris Burdess
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleError(String error, RedisSession session)
    Called when the command fails with a Redis error.
    void
    handleResult(long value, RedisSession session)
    Called when the command succeeds with an integer result.
  • Method Details

    • handleResult

      void handleResult(long value, RedisSession session)
      Called when the command succeeds with an integer result.
      Parameters:
      value - the integer result
      session - the session for further operations
    • handleError

      void handleError(String error, RedisSession session)
      Called when the command fails with a Redis error.
      Parameters:
      error - the error message from Redis
      session - the session for further operations