Class Jedis

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public final class Jedis
    extends java.lang.Object
    implements java.io.Closeable
    Jedis compatibility wrapper for Valkey GLIDE client. This class provides a Jedis-like API while using Valkey GLIDE underneath for improved performance, reliability, and feature support.

    This compatibility layer allows existing Jedis applications to migrate to Valkey GLIDE with minimal code changes while benefiting from GLIDE's advanced features such as:

    • Improved connection management and pooling
    • Better error handling and retry mechanisms
    • Enhanced performance optimizations
    • Support for the latest Valkey features

    The class implements the same method signatures as the original Jedis client, ensuring drop-in compatibility for most use cases. Some advanced features may require migration to native GLIDE APIs for optimal performance.

    Example usage:

    
     try (Jedis jedis = new Jedis("localhost", 6379)) {
         jedis.set("key", "value");
         String value = jedis.get("key");
     }
     
    Since:
    1.0.0
    See Also:
    GlideClient, JedisClientConfig
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Jedis()
      Create a new Jedis instance with default localhost:6379 connection.
      protected Jedis​(glide.api.GlideClient glideClient, JedisClientConfig config)
      Internal constructor for pooled connections.
        Jedis​(java.lang.String host, int port)
      Create a new Jedis instance with specified host and port.
        Jedis​(java.lang.String host, int port, boolean useSsl)
      Create a new Jedis instance with specified host, port and SSL configuration.
        Jedis​(java.lang.String host, int port, boolean ssl, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
      Create a new Jedis instance with comprehensive SSL/TLS configuration.
        Jedis​(java.lang.String host, int port, int timeout)
      Create Jedis with timeout configuration.
        Jedis​(java.lang.String host, int port, JedisClientConfig config)
      Create a new Jedis instance with full configuration.
        Jedis​(Connection connection)
      Constructor with Connection (compatibility stub).
        Jedis​(HostAndPort hostAndPort, JedisClientConfig config)
      Create a new Jedis instance with host and port from HostAndPort and configuration.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      long append​(byte[] key, byte[] value)
      Append a binary value to the end of the string stored at the specified key.
      long append​(java.lang.String key, java.lang.String value)
      Append a value to the end of the string stored at the specified key.
      java.lang.String auth​(java.lang.String password)
      Authenticate with the server.
      java.lang.String auth​(java.lang.String user, java.lang.String password)
      Authenticate with username and password.
      long bitcount​(byte[] key)
      Count the number of set bits in a string.
      long bitcount​(byte[] key, long start, long end)
      Count the number of set bits in a string at a range.
      long bitcount​(byte[] key, long start, long end, BitCountOption option)
      Count the number of set bits in a string at a range with bit count option.
      long bitcount​(java.lang.String key)
      Count the number of set bits (population counting) in a string.
      long bitcount​(java.lang.String key, long start, long end)
      Count the number of set bits (population counting) in a string within a specified byte range.
      long bitcount​(java.lang.String key, long start, long end, BitCountOption option)
      Count the number of set bits in a string at a range with bit count option.
      java.util.List<java.lang.Long> bitfield​(byte[] key, byte[]... arguments)
      Perform multiple bitfield operations on a string.
      java.util.List<java.lang.Long> bitfield​(java.lang.String key, java.lang.String... arguments)
      Perform multiple bitfield operations on a string.
      java.util.List<java.lang.Long> bitfieldReadonly​(byte[] key, byte[]... arguments)
      Perform read-only bitfield operations on a string.
      java.util.List<java.lang.Long> bitfieldReadonly​(java.lang.String key, java.lang.String... arguments)
      Perform read-only bitfield operations on a string.
      long bitop​(BitOP op, byte[] destKey, byte[]... srcKeys)
      Perform bitwise operations between strings.
      long bitop​(BitOP op, java.lang.String destKey, java.lang.String... srcKeys)
      Perform bitwise operations between strings.
      long bitpos​(byte[] key, boolean value)
      Return the position of the first bit set to 1 or 0 in a string within a range.
      long bitpos​(byte[] key, boolean value, BitPosParams params)
      Return the position of the first bit set to 1 or 0 in a string with parameters.
      long bitpos​(java.lang.String key, boolean value)
      Return the position of the first bit set to 1 or 0 in a string.
      long bitpos​(java.lang.String key, boolean value, BitPosParams params)
      /** Return the position of the first bit set to 1 or 0 in a string with parameters.
      byte[] blmove​(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, double timeout)
      Blocking version of LMOVE.
      java.lang.String blmove​(java.lang.String srcKey, java.lang.String dstKey, ListDirection from, ListDirection to, double timeout)
      Atomically moves an element from one list to another (binary version).
      KeyValue<byte[],​java.util.List<byte[]>> blmpop​(double timeout, ListDirection direction, byte[]... keys)
      Blocking version of LMPOP.
      KeyValue<byte[],​java.util.List<byte[]>> blmpop​(double timeout, ListDirection direction, int count, byte[]... keys)
      Blocking version of LMPOP.
      KeyValue<java.lang.String,​java.util.List<java.lang.String>> blmpop​(double timeout, ListDirection direction, int count, java.lang.String... keys)
      Blocking version of LMPOP.
      KeyValue<java.lang.String,​java.util.List<java.lang.String>> blmpop​(double timeout, ListDirection direction, java.lang.String... keys)
      Blocking version of LMPOP.
      KeyValue<byte[],​byte[]> blpop​(double timeout, byte[]... keys)
      BLPOP is a blocking list pop primitive.
      KeyValue<java.lang.String,​java.lang.String> blpop​(double timeout, java.lang.String key)
      BLPOP is a blocking list pop primitive for a single key.
      KeyValue<java.lang.String,​java.lang.String> blpop​(double timeout, java.lang.String... keys)
      BLPOP is a blocking list pop primitive.
      java.util.List<byte[]> blpop​(int timeout, byte[]... keys)
      BLPOP is a blocking list pop primitive.
      java.util.List<java.lang.String> blpop​(int timeout, java.lang.String key)
      BLPOP is a blocking list pop primitive for a single key.
      java.util.List<java.lang.String> blpop​(int timeout, java.lang.String... keys)
      BLPOP is a blocking list pop primitive.
      KeyValue<byte[],​byte[]> brpop​(double timeout, byte[]... keys)
      BRPOP is a blocking list pop primitive.
      KeyValue<java.lang.String,​java.lang.String> brpop​(double timeout, java.lang.String key)
      BRPOP is a blocking list pop primitive for a single key.
      KeyValue<java.lang.String,​java.lang.String> brpop​(double timeout, java.lang.String... keys)
      BRPOP is a blocking list pop primitive.
      java.util.List<byte[]> brpop​(int timeout, byte[]... keys)
      BRPOP is a blocking list pop primitive.
      java.util.List<java.lang.String> brpop​(int timeout, java.lang.String key)
      BRPOP is a blocking list pop primitive for a single key.
      java.util.List<java.lang.String> brpop​(int timeout, java.lang.String... keys)
      BRPOP is a blocking list pop primitive.
      byte[] brpoplpush​(byte[] source, byte[] destination, int timeout)
      Deprecated.
      Use BLMOVE instead
      java.lang.String brpoplpush​(java.lang.String source, java.lang.String destination, int timeout)
      Deprecated.
      Use BLMOVE instead
      void close()
      Close the connection.
      void connect()
      Connect to the Valkey server.
      boolean copy​(byte[] srcKey, byte[] dstKey, boolean replace)
      Copy a key to another key.
      boolean copy​(byte[] srcKey, byte[] dstKey, int db, boolean replace)
      Copy a key to another key in a different database.
      boolean copy​(java.lang.String srcKey, java.lang.String dstKey, boolean replace)
      Copy a key to another key.
      boolean copy​(java.lang.String srcKey, java.lang.String dstKey, int db, boolean replace)
      Copy a key to another key in a different database.
      long decr​(byte[] key)
      Decrement the integer value of key by 1.
      long decr​(java.lang.String key)
      Decrement the integer value of key by 1.
      long decrBy​(byte[] key, long decrement)
      Decrement the integer value of a key by the given amount (alternative method name).
      long decrBy​(java.lang.String key, long decrement)
      Decrement the integer value of key by amount.
      long del​(byte[] key)
      Delete one or more keys.
      long del​(byte[]... keys)
      Delete one or more keys.
      long del​(java.lang.String key)
      Delete one or more keys.
      long del​(java.lang.String... keys)
      Delete one or more keys.
      byte[] dump​(byte[] key)
      Serialize a key's value.
      byte[] dump​(java.lang.String key)
      Serialize a key's value.
      boolean exists​(byte[] key)
      Check if a key exists.
      long exists​(byte[]... keys)
      Check if one or more keys exist.
      boolean exists​(java.lang.String key)
      Check if a key exists.
      long exists​(java.lang.String... keys)
      Check if one or more keys exist.
      long expire​(byte[] key, long seconds)
      Set expiration time in seconds.
      long expire​(byte[] key, long seconds, ExpiryOption expiryOption)
      Set expiration time in seconds with expiry option.
      long expire​(java.lang.String key, long seconds)
      Set expiration time in seconds.
      long expire​(java.lang.String key, long seconds, ExpiryOption expiryOption)
      Set expiration time in seconds with expiry option.
      long expireAt​(byte[] key, long unixTime)
      Set expiration time at a specific timestamp.
      long expireAt​(byte[] key, long unixTime, ExpiryOption expiryOption)
      Set expiration time at a specific timestamp with expiry option.
      long expireAt​(java.lang.String key, long unixTime)
      Set the expiration time of a key as a Unix timestamp (seconds since January 1, 1970).
      long expireAt​(java.lang.String key, long unixTime, ExpiryOption expiryOption)
      Set expiration time at a specific timestamp with expiry option.
      long expireTime​(byte[] key)
      Get the expiration timestamp of a key in seconds.
      long expireTime​(java.lang.String key)
      Get the expiration timestamp of a key in seconds.
      byte[] get​(byte[] key)
      Get the value of a key.
      java.lang.String get​(java.lang.String key)
      Get the string value of a key.
      boolean getbit​(byte[] key, long offset)
      Returns the bit value at offset in the string value stored at key.
      boolean getbit​(java.lang.String key, long offset)
      Returns the bit value at offset in the string value stored at key.
      JedisClientConfig getConfig()
      Get the client configuration.
      int getDB()
      Get the current database index.
      byte[] getDel​(byte[] key)
      Get value and delete key.
      java.lang.String getDel​(java.lang.String key)
      Get value and delete key.
      byte[] getEx​(byte[] key, GetExParams params)
      Get the binary value of a key and optionally set its expiration.
      java.lang.String getEx​(java.lang.String key, GetExParams params)
      Get the value of a key and optionally set its expiration.
      protected glide.api.GlideClient getGlideClient()
      Get the underlying GLIDE client.
      byte[] getSet​(byte[] key, byte[] value)
      Deprecated.
      java.lang.String getSet​(java.lang.String key, java.lang.String value)
      Deprecated.
      long hdel​(byte[] key, byte[]... fields)
      Removes the specified fields from the hash stored at key (binary version).
      long hdel​(java.lang.String key, java.lang.String... fields)
      Removes the specified fields from the hash stored at key.
      boolean hexists​(byte[] key, byte[] field)
      Returns if field is an existing field in the hash stored at key (binary version).
      boolean hexists​(java.lang.String key, java.lang.String field)
      Returns if field is an existing field in the hash stored at key.
      java.util.List<java.lang.Long> hexpire​(byte[] key, long seconds, byte[]... fields)
      Set expiry for hash field using relative time to expire (seconds) - binary version.
      java.util.List<java.lang.Long> hexpire​(byte[] key, long seconds, ExpiryOption condition, byte[]... fields)
      Set expiry for hash field using relative time to expire (seconds) with condition - binary version.
      java.util.List<java.lang.Long> hexpire​(java.lang.String key, long seconds, java.lang.String... fields)
      Set expiry for hash field using relative time to expire (seconds).
      java.util.List<java.lang.Long> hexpire​(java.lang.String key, long seconds, ExpiryOption condition, java.lang.String... fields)
      Set expiry for hash field using relative time to expire (seconds) with condition.
      java.util.List<java.lang.Long> hexpireAt​(byte[] key, long unixTimeSeconds, byte[]... fields)
      Set expiry for hash field using an absolute Unix timestamp (seconds) - binary version.
      java.util.List<java.lang.Long> hexpireAt​(byte[] key, long unixTimeSeconds, ExpiryOption condition, byte[]... fields)
      Set expiry for hash field using an absolute Unix timestamp (seconds) with condition - binary version.
      java.util.List<java.lang.Long> hexpireAt​(java.lang.String key, long unixTimeSeconds, java.lang.String... fields)
      Set expiry for hash field using an absolute Unix timestamp (seconds).
      java.util.List<java.lang.Long> hexpireAt​(java.lang.String key, long unixTimeSeconds, ExpiryOption condition, java.lang.String... fields)
      Set expiry for hash field using an absolute Unix timestamp (seconds) with condition.
      java.util.List<java.lang.Long> hexpireTime​(byte[] key, byte[]... fields)
      Returns the expiration time of a hash field as a Unix timestamp, in seconds - binary version.
      java.util.List<java.lang.Long> hexpireTime​(java.lang.String key, java.lang.String... fields)
      Returns the expiration time of a hash field as a Unix timestamp, in seconds.
      byte[] hget​(byte[] key, byte[] field)
      Returns the value associated with field in the hash stored at key (binary version).
      java.lang.String hget​(java.lang.String key, java.lang.String field)
      Returns the value associated with field in the hash stored at key.
      java.util.Map<byte[],​byte[]> hgetAll​(byte[] key)
      Returns all fields and values of the hash stored at key (binary version).
      java.util.Map<java.lang.String,​java.lang.String> hgetAll​(java.lang.String key)
      Returns all fields and values of the hash stored at key.
      java.util.List<byte[]> hgetdel​(byte[] key, byte[]... fields)
      Retrieves the values associated with the specified fields in the hash stored at the given key and then deletes those fields from the hash (binary version).
      java.util.List<java.lang.String> hgetdel​(java.lang.String key, java.lang.String... fields)
      Retrieves the values associated with the specified fields in the hash stored at the given key and then deletes those fields from the hash.
      java.util.List<byte[]> hgetex​(byte[] key, HGetExParams params, byte[]... fields)
      Retrieves the values associated with the specified fields in a hash stored at the given key and optionally sets their expiration (binary version).
      java.util.List<java.lang.String> hgetex​(java.lang.String key, HGetExParams params, java.lang.String... fields)
      Retrieves the values associated with the specified fields in a hash stored at the given key and optionally sets their expiration.
      long hincrBy​(byte[] key, byte[] field, long value)
      Increments the number stored at field in the hash stored at key by increment (binary version).
      long hincrBy​(java.lang.String key, java.lang.String field, long value)
      Increments the number stored at field in the hash stored at key by increment.
      double hincrByFloat​(byte[] key, byte[] field, double value)
      Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment (binary version).
      double hincrByFloat​(java.lang.String key, java.lang.String field, double value)
      Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.
      java.util.Set<byte[]> hkeys​(byte[] key)
      Returns all field names in the hash stored at key (binary version).
      java.util.Set<java.lang.String> hkeys​(java.lang.String key)
      Returns all field names in the hash stored at key.
      long hlen​(byte[] key)
      Returns the number of fields contained in the hash stored at key (binary version).
      long hlen​(java.lang.String key)
      Returns the number of fields contained in the hash stored at key.
      java.util.List<byte[]> hmget​(byte[] key, byte[]... fields)
      Returns the values associated with the specified fields in the hash stored at key (binary version).
      java.util.List<java.lang.String> hmget​(java.lang.String key, java.lang.String... fields)
      Returns the values associated with the specified fields in the hash stored at key.
      java.lang.String hmset​(byte[] key, java.util.Map<byte[],​byte[]> hash)
      Sets the specified fields to their respective values in the hash stored at key (binary version).
      java.lang.String hmset​(java.lang.String key, java.util.Map<java.lang.String,​java.lang.String> hash)
      Sets the specified fields to their respective values in the hash stored at key.
      java.util.List<java.lang.Long> hpersist​(byte[] key, byte[]... fields)
      Removes the expiration time for each specified field - binary version.
      java.util.List<java.lang.Long> hpersist​(java.lang.String key, java.lang.String... fields)
      Removes the expiration time for each specified field.
      java.util.List<java.lang.Long> hpexpire​(byte[] key, long milliseconds, byte[]... fields)
      Set expiry for hash field using relative time to expire (milliseconds) - binary version.
      java.util.List<java.lang.Long> hpexpire​(byte[] key, long milliseconds, ExpiryOption condition, byte[]... fields)
      Set expiry for hash field using relative time to expire (milliseconds) with condition - binary version.
      java.util.List<java.lang.Long> hpexpire​(java.lang.String key, long milliseconds, java.lang.String... fields)
      Set expiry for hash field using relative time to expire (milliseconds).
      java.util.List<java.lang.Long> hpexpire​(java.lang.String key, long milliseconds, ExpiryOption condition, java.lang.String... fields)
      Set expiry for hash field using relative time to expire (milliseconds) with condition.
      java.util.List<java.lang.Long> hpexpireAt​(byte[] key, long unixTimeMillis, byte[]... fields)
      Set expiry for hash field using an absolute Unix timestamp (milliseconds) - binary version.
      java.util.List<java.lang.Long> hpexpireAt​(byte[] key, long unixTimeMillis, ExpiryOption condition, byte[]... fields)
      Set expiry for hash field using an absolute Unix timestamp (milliseconds) with condition - binary version.
      java.util.List<java.lang.Long> hpexpireAt​(java.lang.String key, long unixTimeMillis, java.lang.String... fields)
      Set expiry for hash field using an absolute Unix timestamp (milliseconds).
      java.util.List<java.lang.Long> hpexpireAt​(java.lang.String key, long unixTimeMillis, ExpiryOption condition, java.lang.String... fields)
      Set expiry for hash field using an absolute Unix timestamp (milliseconds) with condition.
      java.util.List<java.lang.Long> hpexpireTime​(byte[] key, byte[]... fields)
      Returns the expiration time of a hash field as a Unix timestamp, in milliseconds - binary version.
      java.util.List<java.lang.Long> hpexpireTime​(java.lang.String key, java.lang.String... fields)
      Returns the expiration time of a hash field as a Unix timestamp, in milliseconds.
      java.util.List<java.lang.Long> hpttl​(byte[] key, byte[]... fields)
      Returns the TTL in milliseconds of a hash field - binary version.
      java.util.List<java.lang.Long> hpttl​(java.lang.String key, java.lang.String... fields)
      Returns the TTL in milliseconds of a hash field.
      byte[] hrandfield​(byte[] key)
      Returns a random field from the hash value stored at key (binary version).
      java.util.List<byte[]> hrandfield​(byte[] key, long count)
      Returns an array of random fields from the hash value stored at key (binary version).
      java.lang.String hrandfield​(java.lang.String key)
      Returns a random field from the hash value stored at key.
      java.util.List<java.lang.String> hrandfield​(java.lang.String key, long count)
      Returns an array of random fields from the hash value stored at key.
      java.util.List<java.util.Map.Entry<byte[],​byte[]>> hrandfieldWithValues​(byte[] key, long count)
      Returns an array of random field-value pairs from the hash value stored at key (binary version).
      java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> hrandfieldWithValues​(java.lang.String key, long count)
      Returns an array of random field-value pairs from the hash value stored at key.
      ScanResult<java.util.Map.Entry<byte[],​byte[]>> hscan​(byte[] key, byte[] cursor)
      Iterates fields of Hash types and their associated values (binary version).
      ScanResult<java.util.Map.Entry<byte[],​byte[]>> hscan​(byte[] key, byte[] cursor, ScanParams params)
      Iterates fields of Hash types and their associated values (binary version).
      ScanResult<java.util.Map.Entry<java.lang.String,​java.lang.String>> hscan​(java.lang.String key, java.lang.String cursor)
      Iterates fields of Hash types and their associated values.
      ScanResult<java.util.Map.Entry<java.lang.String,​java.lang.String>> hscan​(java.lang.String key, java.lang.String cursor, ScanParams params)
      Iterates fields of Hash types and their associated values.
      ScanResult<byte[]> hscanNoValues​(byte[] key, byte[] cursor)
      Iterates fields of Hash types without their values (binary version).
      ScanResult<byte[]> hscanNoValues​(byte[] key, byte[] cursor, ScanParams params)
      Iterates fields of Hash types without their values (binary version).
      ScanResult<java.lang.String> hscanNoValues​(java.lang.String key, java.lang.String cursor)
      Iterates fields of Hash types without their values.
      ScanResult<java.lang.String> hscanNoValues​(java.lang.String key, java.lang.String cursor, ScanParams params)
      Iterates fields of Hash types without their values.
      long hset​(byte[] key, byte[] field, byte[] value)
      Sets the specified field in the hash stored at key to value (binary version).
      long hset​(byte[] key, java.util.Map<byte[],​byte[]> hash)
      Sets the specified fields to their respective values in the hash stored at key (binary version).
      long hset​(java.lang.String key, java.lang.String field, java.lang.String value)
      Sets the specified field in the hash stored at key to value.
      long hset​(java.lang.String key, java.util.Map<java.lang.String,​java.lang.String> hash)
      Sets the specified fields to their respective values in the hash stored at key.
      long hsetex​(byte[] key, HSetExParams params, byte[] field, byte[] value)
      Sets the specified field in the hash stored at key to value with expiration and existence conditions (binary version).
      long hsetex​(byte[] key, HSetExParams params, java.util.Map<byte[],​byte[]> hash)
      Sets the specified fields to their respective values in the hash stored at key with expiration and existence conditions (binary version).
      long hsetex​(java.lang.String key, HSetExParams params, java.lang.String field, java.lang.String value)
      Sets the specified field in the hash stored at key to value with expiration and existence conditions.
      long hsetex​(java.lang.String key, HSetExParams params, java.util.Map<java.lang.String,​java.lang.String> hash)
      Sets the specified fields to their respective values in the hash stored at key with expiration and existence conditions.
      long hsetnx​(byte[] key, byte[] field, byte[] value)
      Sets field in the hash stored at key to value, only if field does not yet exist (binary version).
      long hsetnx​(java.lang.String key, java.lang.String field, java.lang.String value)
      Sets field in the hash stored at key to value, only if field does not yet exist.
      long hstrlen​(byte[] key, byte[] field)
      Returns the string length of the value associated with field in the hash stored at key (binary version).
      long hstrlen​(java.lang.String key, java.lang.String field)
      Returns the string length of the value associated with field in the hash stored at key.
      java.util.List<java.lang.Long> httl​(byte[] key, byte[]... fields)
      Returns the TTL in seconds of a hash field - binary version.
      java.util.List<java.lang.Long> httl​(java.lang.String key, java.lang.String... fields)
      Returns the TTL in seconds of a hash field.
      java.util.List<byte[]> hvals​(byte[] key)
      Returns all values in the hash stored at key (binary version).
      java.util.List<java.lang.String> hvals​(java.lang.String key)
      Returns all values in the hash stored at key.
      long incr​(byte[] key)
      Increment the integer value of key by 1.
      long incr​(java.lang.String key)
      Increment the integer value of key by 1.
      long incrBy​(byte[] key, long increment)
      Increment the integer value of a key by the given amount (alternative method name).
      long incrBy​(java.lang.String key, long increment)
      Increment the integer value of key by amount.
      double incrByFloat​(byte[] key, double increment)
      Increment the float value of a key by the given amount.
      double incrByFloat​(java.lang.String key, double increment)
      Increment the float value of key by amount.
      boolean isClosed()
      Check if the connection is closed.
      protected boolean isPooled()
      Check if this connection is from a pool.
      boolean keyExists​(byte[] key)
      Check if a key exists (boolean version for Jedis compatibility).
      boolean keyExists​(java.lang.String key)
      Check if a key exists (boolean version for Jedis compatibility).
      java.util.Set<byte[]> keys​(byte[] pattern)
      Find all keys matching the given pattern.
      java.util.Set<java.lang.String> keys​(java.lang.String pattern)
      Find all keys matching the given pattern.
      byte[] lindex​(byte[] key, long index)
      Returns the element at index in the list stored at key (binary version).
      java.lang.String lindex​(java.lang.String key, long index)
      Returns the element at index in the list stored at key.
      long linsert​(byte[] key, ListPosition where, byte[] pivot, byte[] element)
      Inserts element in the list stored at key either before or after the reference value pivot (binary version).
      long linsert​(java.lang.String key, ListPosition where, java.lang.String pivot, java.lang.String element)
      Inserts element in the list stored at key either before or after the reference value pivot.
      long llen​(byte[] key)
      Returns the length of the list stored at key (binary version).
      long llen​(java.lang.String key)
      Returns the length of the list stored at key.
      byte[] lmove​(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to)
      Atomically moves an element from one list to another (binary version).
      java.lang.String lmove​(java.lang.String srcKey, java.lang.String dstKey, ListDirection from, ListDirection to)
      Atomically moves an element from one list to another.
      KeyValue<byte[],​java.util.List<byte[]>> lmpop​(ListDirection direction, byte[]... keys)
      Pops one or more elements from the first non-empty list key from the list of provided key names (binary version).
      KeyValue<byte[],​java.util.List<byte[]>> lmpop​(ListDirection direction, int count, byte[]... keys)
      Pops one or more elements from the first non-empty list key from the list of provided key names (binary version).
      KeyValue<java.lang.String,​java.util.List<java.lang.String>> lmpop​(ListDirection direction, int count, java.lang.String... keys)
      Pops one or more elements from the first non-empty list key from the list of provided key names.
      KeyValue<java.lang.String,​java.util.List<java.lang.String>> lmpop​(ListDirection direction, java.lang.String... keys)
      Pops one or more elements from the first non-empty list key from the list of provided key names.
      byte[] lpop​(byte[] key)
      Removes and returns the first element of the list stored at key (binary version).
      java.util.List<byte[]> lpop​(byte[] key, int count)
      Removes and returns up to count elements from the head of the list stored at key (binary version).
      java.lang.String lpop​(java.lang.String key)
      Removes and returns the first element of the list stored at key.
      java.util.List<java.lang.String> lpop​(java.lang.String key, int count)
      Removes and returns up to count elements from the head of the list stored at key.
      java.lang.Long lpos​(byte[] key, byte[] element)
      Returns the index of the first matching element in the list stored at key (binary version).
      java.lang.Long lpos​(byte[] key, byte[] element, LPosParams params)
      Returns the index of matching elements in the list stored at key with additional options (binary version).
      java.util.List<java.lang.Long> lpos​(byte[] key, byte[] element, LPosParams params, long count)
      Returns the indices of matching elements in the list stored at key (binary version).
      java.lang.Long lpos​(java.lang.String key, java.lang.String element)
      Returns the index of the first matching element in the list stored at key.
      java.lang.Long lpos​(java.lang.String key, java.lang.String element, LPosParams params)
      Returns the index of matching elements in the list stored at key with additional options.
      java.util.List<java.lang.Long> lpos​(java.lang.String key, java.lang.String element, LPosParams params, long count)
      Returns the indices of matching elements in the list stored at key.
      long lpush​(byte[] key, byte[]... strings)
      Inserts all the specified values at the head of the list stored at key (binary version).
      long lpush​(java.lang.String key, java.lang.String... strings)
      Inserts all the specified values at the head of the list stored at key.
      long lpushx​(byte[] key, byte[]... strings)
      Inserts specified values at the head of the list stored at key, only if key already exists and holds a list (binary version).
      long lpushx​(java.lang.String key, java.lang.String... strings)
      Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
      java.util.List<byte[]> lrange​(byte[] key, long start, long stop)
      Returns the specified elements of the list stored at key (binary version).
      java.util.List<java.lang.String> lrange​(java.lang.String key, long start, long stop)
      Returns the specified elements of the list stored at key.
      long lrem​(byte[] key, long count, byte[] element)
      Removes the first count occurrences of elements equal to element from the list stored at key (binary version).
      long lrem​(java.lang.String key, long count, java.lang.String element)
      Removes the first count occurrences of elements equal to element from the list stored at key.
      java.lang.String lset​(byte[] key, long index, byte[] element)
      Sets the list element at index to element (binary version).
      java.lang.String lset​(java.lang.String key, long index, java.lang.String element)
      Sets the list element at index to element.
      java.lang.String ltrim​(byte[] key, long start, long stop)
      Trim an existing list so that it will contain only the specified range of elements specified (binary version).
      java.lang.String ltrim​(java.lang.String key, long start, long stop)
      Trim an existing list so that it will contain only the specified range of elements specified.
      java.util.List<byte[]> mget​(byte[]... keys)
      Get multiple values.
      java.util.List<java.lang.String> mget​(java.lang.String... keys)
      Get multiple values.
      java.lang.String migrate​(java.lang.String host, int port, java.lang.String key, int destinationDb, int timeout)
      Move a key to another Valkey instance.
      long move​(byte[] key, int dbIndex)
      Move a key to another database.
      long move​(java.lang.String key, int dbIndex)
      Move a key to another database.
      java.lang.String mset​(byte[]... keysvalues)
      Set multiple key-value pairs.
      java.lang.String mset​(java.lang.String... keysvalues)
      Set multiple key-value pairs.
      java.lang.String mset​(java.util.Map<java.lang.String,​java.lang.String> keyValueMap)
      Set multiple key-value pairs.
      long persist​(byte[] key)
      Remove the expiration from a key.
      long persist​(java.lang.String key)
      Remove the expiration from a key.
      long pexpire​(byte[] key, long milliseconds)
      Set expiration time in milliseconds.
      long pexpire​(byte[] key, long milliseconds, ExpiryOption expiryOption)
      Set expiration time in milliseconds with expiry option.
      long pexpire​(java.lang.String key, long milliseconds)
      Set expiration time in milliseconds.
      long pexpire​(java.lang.String key, long milliseconds, ExpiryOption expiryOption)
      Set expiration time in milliseconds with expiry option.
      long pexpireat​(byte[] key, long millisecondsTimestamp)
      Set expiration time at a specific timestamp in milliseconds.
      long pexpireAt​(byte[] key, long millisecondsTimestamp)
      Set expiration time at a specific millisecond timestamp.
      long pexpireAt​(byte[] key, long millisecondsTimestamp, ExpiryOption expiryOption)
      Set expiration time at a specific millisecond timestamp with expiry option.
      long pexpireAt​(java.lang.String key, long millisecondsTimestamp)
      Set expiration time at a specific millisecond timestamp.
      long pexpireAt​(java.lang.String key, long millisecondsTimestamp, ExpiryOption expiryOption)
      Set expiration time at a specific millisecond timestamp with expiry option.
      long pexpireTime​(byte[] key)
      Get the expiration timestamp of a key in milliseconds.
      long pexpireTime​(java.lang.String key)
      Get the expiration timestamp of a key in milliseconds.
      long pfadd​(byte[] key, byte[]... elements)
      Adds all elements to the HyperLogLog data structure stored at the specified key.
      long pfadd​(java.lang.String key, java.lang.String... elements)
      Adds all elements to the HyperLogLog data structure stored at the specified key.
      long pfcount​(byte[] key)
      Estimates the cardinality of the data stored in a HyperLogLog structure for a single key.
      long pfcount​(byte[]... keys)
      Estimates the cardinality of the union of multiple HyperLogLog data structures.
      long pfcount​(java.lang.String key)
      Estimates the cardinality of the data stored in a HyperLogLog structure for a single key.
      long pfcount​(java.lang.String... keys)
      Estimates the cardinality of the data stored in multiple HyperLogLog structures by calculating the combined cardinality of multiple keys.
      java.lang.String pfmerge​(byte[] destKey, byte[]... sourceKeys)
      Merges multiple HyperLogLog values into a unique value.
      java.lang.String pfmerge​(java.lang.String destKey, java.lang.String... sourceKeys)
      Merges multiple HyperLogLog values into a unique value.
      java.lang.String ping()
      Test if the server is alive and responding.
      byte[] ping​(byte[] message)
      Test if the server is alive with a custom message.
      java.lang.String ping​(java.lang.String message)
      Test if the server is alive and echo back a custom message.
      java.lang.String psetex​(byte[] key, long milliseconds, byte[] value)
      Set key to value with expiration in milliseconds.
      java.lang.String psetex​(java.lang.String key, long milliseconds, java.lang.String value)
      Set key to value with expiration in milliseconds.
      long pttl​(byte[] key)
      Get the time to live of a key in milliseconds.
      long pttl​(java.lang.String key)
      Get the time to live of a key in milliseconds.
      java.lang.String randomKey()
      Get a random key from the currently selected database.
      java.lang.String rename​(byte[] oldkey, byte[] newkey)
      Rename a key.
      java.lang.String rename​(java.lang.String oldkey, java.lang.String newkey)
      Rename a key.
      long renamenx​(byte[] oldkey, byte[] newkey)
      Rename a key if the new key does not exist.
      long renamenx​(java.lang.String oldkey, java.lang.String newkey)
      Rename a key if the new key does not exist.
      protected void resetForReuse()
      Reset the closed state for pooled connections.
      java.lang.String restore​(java.lang.String key, long ttl, byte[] serializedValue)
      Deserialize a value and store it at a key.
      byte[] rpop​(byte[] key)
      Removes and returns the last element of the list stored at key (binary version).
      java.util.List<byte[]> rpop​(byte[] key, int count)
      Removes and returns up to count elements from the tail of the list stored at key (binary version).
      java.lang.String rpop​(java.lang.String key)
      Removes and returns the last element of the list stored at key.
      java.util.List<java.lang.String> rpop​(java.lang.String key, int count)
      Removes and returns up to count elements from the tail of the list stored at key.
      byte[] rpoplpush​(byte[] srckey, byte[] dstkey)
      Deprecated.
      Use LMOVE instead
      java.lang.String rpoplpush​(java.lang.String srckey, java.lang.String dstkey)
      Deprecated.
      Use LMOVE instead
      long rpush​(byte[] key, byte[]... strings)
      Inserts all the specified values at the tail of the list stored at key (binary version).
      long rpush​(java.lang.String key, java.lang.String... strings)
      Inserts all the specified values at the tail of the list stored at key.
      long rpushx​(byte[] key, byte[]... strings)
      Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list (binary version).
      long rpushx​(java.lang.String key, java.lang.String... strings)
      Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
      ScanResult<byte[]> scan​(byte[] cursor)
      Iterate over keys in the database.
      ScanResult<byte[]> scan​(byte[] cursor, ScanParams params)
      Iterate over keys in the database with scan parameters.
      ScanResult<byte[]> scan​(byte[] cursor, ScanParams params, byte[] type)
      Iterate over keys in the database with scan parameters and type filter.
      ScanResult<java.lang.String> scan​(java.lang.String cursor)
      Iterate over keys in the database.
      ScanResult<java.lang.String> scan​(java.lang.String cursor, ScanParams params)
      Iterate over keys in the database with scan parameters.
      ScanResult<java.lang.String> scan​(java.lang.String cursor, ScanParams params, java.lang.String type)
      Iterate over keys in the database with scan parameters and type filter.
      java.lang.String select​(int index)
      Select a database.
      java.lang.Object sendBlockingCommand​(ProtocolCommand cmd, byte[]... args)
      Send a blocking command to Valkey server with byte arrays.
      java.lang.Object sendBlockingCommand​(ProtocolCommand cmd, java.lang.String... args)
      Send a blocking command to Valkey server.
      java.lang.Object sendCommand​(ProtocolCommand cmd)
      Sends a command to the Valkey server without arguments.
      java.lang.Object sendCommand​(ProtocolCommand cmd, byte[]... args)
      Sends a Valkey command using the GLIDE client with full compatibility to original Jedis.
      java.lang.Object sendCommand​(ProtocolCommand cmd, java.lang.String... args)
      Sends a command to the Valkey server with string arguments.
      java.lang.String set​(byte[] key, byte[] value)
      Set the binary value of a key.
      java.lang.String set​(byte[] key, byte[] value, SetParams params)
      Set the string value of a key.
      java.lang.String set​(java.lang.String key, java.lang.String value)
      Set the string value of a key.
      java.lang.String set​(java.lang.String key, java.lang.String value, SetParams params)
      Set the string value of a key.
      boolean setbit​(byte[] key, long offset, boolean value)
      Sets or clears the bit at offset in the string value stored at key.
      boolean setbit​(java.lang.String key, long offset, boolean value)
      Sets or clears the bit at offset in the string value stored at key.
      protected void setDataSource​(Pool<Jedis> jedisPool)
      Set the data source (pool) for this Jedis instance.
      java.lang.String setex​(byte[] key, long seconds, byte[] value)
      Set key to value with expiration in seconds.
      java.lang.String setex​(java.lang.String key, long seconds, java.lang.String value)
      Set key to value with expiration in seconds.
      byte[] setGet​(byte[] key, byte[] value)
      Set the binary value of a key and return its old value.
      byte[] setGet​(byte[] key, byte[] value, SetParams params)
      Get old value and set new value with additional parameters.
      java.lang.String setGet​(java.lang.String key, java.lang.String value)
      Set the string value of a key and return its old value.
      java.lang.String setGet​(java.lang.String key, java.lang.String value, SetParams params)
      Get old value and set new value with additional parameters.
      long setnx​(byte[] key, byte[] value)
      Set key to value only if key does not exist.
      long setnx​(java.lang.String key, java.lang.String value)
      Set key to value if key does not exist.
      java.util.List<java.lang.String> sort​(java.lang.String key)
      Sort the elements in a list, set, or sorted set.
      java.util.List<java.lang.String> sort​(java.lang.String key, java.lang.String... sortingParameters)
      Sort the elements in a list, set, or sorted set with options.
      long strlen​(byte[] key)
      Get the length of the string value stored at key.
      long strlen​(java.lang.String key)
      Get the length of the string value stored at key.
      long touch​(byte[] key)
      Update the last access time of a key.
      long touch​(byte[]... keys)
      Update the last access time of keys.
      long touch​(java.lang.String... keys)
      Update the last access time of keys.
      long ttl​(byte[] key)
      Get the time to live of a key in seconds.
      long ttl​(java.lang.String key)
      Get the time to live of a key in seconds.
      java.lang.String type​(byte[] key)
      Get the type of a key.
      java.lang.String type​(java.lang.String key)
      Get the type of a key.
      long unlink​(byte[] key)
      Asynchronously delete a key.
      long unlink​(byte[]... keys)
      Asynchronously delete one or more keys.
      long unlink​(java.lang.String... keys)
      Asynchronously delete one or more keys.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Jedis

        public Jedis()
        Create a new Jedis instance with default localhost:6379 connection.
      • Jedis

        public Jedis​(java.lang.String host,
                     int port)
        Create a new Jedis instance with specified host and port.
        Parameters:
        host - the Valkey server host
        port - the Valkey server port
      • Jedis

        public Jedis​(java.lang.String host,
                     int port,
                     boolean useSsl)
        Create a new Jedis instance with specified host, port and SSL configuration.
        Parameters:
        host - the Valkey server host
        port - the Valkey server port
        useSsl - whether to use SSL/TLS
      • Jedis

        public Jedis​(java.lang.String host,
                     int port,
                     JedisClientConfig config)
        Create a new Jedis instance with full configuration.
        Parameters:
        host - the Valkey server host
        port - the Valkey server port
        config - the jedis client configuration
      • Jedis

        public Jedis​(java.lang.String host,
                     int port,
                     boolean ssl,
                     javax.net.ssl.SSLSocketFactory sslSocketFactory,
                     javax.net.ssl.SSLParameters sslParameters,
                     javax.net.ssl.HostnameVerifier hostnameVerifier)
        Create a new Jedis instance with comprehensive SSL/TLS configuration. This constructor provides full control over SSL settings including custom socket factories and hostname verification.
        Parameters:
        host - the Valkey server host (must not be null)
        port - the Valkey server port (must be positive)
        ssl - whether to use SSL/TLS encryption for the connection
        sslSocketFactory - custom SSL socket factory for advanced SSL configuration (can be null for default)
        sslParameters - SSL parameters for fine-tuning SSL behavior (can be null for default)
        hostnameVerifier - hostname verifier for SSL certificate validation (can be null for default)
        Throws:
        JedisException - if the connection cannot be established
      • Jedis

        public Jedis​(java.lang.String host,
                     int port,
                     int timeout)
        Create Jedis with timeout configuration.
        Parameters:
        host - the server host
        port - the server port
        timeout - the timeout in milliseconds
      • Jedis

        public Jedis​(HostAndPort hostAndPort,
                     JedisClientConfig config)
        Create a new Jedis instance with host and port from HostAndPort and configuration.
        Parameters:
        hostAndPort - the host and port
        config - the jedis client configuration
      • Jedis

        protected Jedis​(glide.api.GlideClient glideClient,
                        JedisClientConfig config)
        Internal constructor for pooled connections. This follows the original Jedis pattern where the pool reference is set separately.
        Parameters:
        glideClient - the underlying GLIDE client
        config - the client configuration
      • Jedis

        public Jedis​(Connection connection)
        Constructor with Connection (compatibility stub). NOTE: Connection is not used in GLIDE compatibility layer.
    • Method Detail

      • set

        public java.lang.String set​(java.lang.String key,
                                    java.lang.String value)
        Set the string value of a key. If the key already exists, its value will be overwritten. This is the most basic Valkey SET operation.
        Parameters:
        key - the key to set (must not be null)
        value - the value to set (must not be null)
        Returns:
        "OK" if successful
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 1.0.0
      • set

        public java.lang.String set​(byte[] key,
                                    byte[] value)
        Set the binary value of a key.
        Parameters:
        key - the key
        value - the value
        Returns:
        "OK" if successful
      • set

        public java.lang.String set​(java.lang.String key,
                                    java.lang.String value,
                                    SetParams params)
        Set the string value of a key.
        Parameters:
        key - the key
        value - the value
        params - set parameters
        Returns:
        "OK" if successful, null if not set due to conditions
      • set

        public java.lang.String set​(byte[] key,
                                    byte[] value,
                                    SetParams params)
        Set the string value of a key.
        Parameters:
        key - the key
        value - the value
        params - set parameters
        Returns:
        "OK" if successful, null if not set due to conditions
      • get

        public java.lang.String get​(java.lang.String key)
        Get the string value of a key. This is the most basic Valkey GET operation.
        Parameters:
        key - the key to retrieve the value from (must not be null)
        Returns:
        the value stored at the key, or null if the key does not exist
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 1.0.0
      • get

        public byte[] get​(byte[] key)
        Get the value of a key.
        Parameters:
        key - the key
        Returns:
        the value of the key, or null if the key does not exist
      • ping

        public java.lang.String ping()
        Test if the server is alive and responding. This command is often used for health checks and connection testing. The server will respond with "PONG" if it's functioning correctly.
        Returns:
        "PONG" if the server is responding
        Throws:
        JedisException - if the operation fails or connection is lost
        Since:
        Valkey 1.0.0
      • ping

        public java.lang.String ping​(java.lang.String message)
        Test if the server is alive and echo back a custom message. This variant of PING allows you to send a custom message that will be echoed back by the server, useful for testing message integrity and round-trip functionality.
        Parameters:
        message - the message to echo back (must not be null)
        Returns:
        the echoed message exactly as sent
        Throws:
        JedisException - if the operation fails or connection is lost
        Since:
        Valkey 2.8.0
      • ping

        public byte[] ping​(byte[] message)
        Test if the server is alive with a custom message.
        Parameters:
        message - the message to echo back
        Returns:
        the echoed message
      • select

        public java.lang.String select​(int index)
        Select a database.
        Parameters:
        index - the database index
        Returns:
        "OK" if successful
      • auth

        public java.lang.String auth​(java.lang.String password)
        Authenticate with the server.
        Parameters:
        password - the password
        Returns:
        "OK" if successful
      • auth

        public java.lang.String auth​(java.lang.String user,
                                     java.lang.String password)
        Authenticate with username and password.
        Parameters:
        user - the username
        password - the password
        Returns:
        "OK" if successful
      • isClosed

        public boolean isClosed()
        Check if the connection is closed.
        Returns:
        true if closed
      • connect

        public void connect()
        Connect to the Valkey server.

        Note: This method is provided for Jedis API compatibility only. In the Valkey GLIDE compatibility layer, connections are established automatically during object construction. This method performs no operation since the underlying GLIDE client is already connected when the Jedis object is created successfully.

        Unlike the original Jedis client which uses lazy connection initialization, this compatibility layer uses eager connection establishment for better error handling and simplified resource management.

        Throws:
        JedisException - if the connection is already closed
        See Also:
        isClosed(), close()
      • getConfig

        public JedisClientConfig getConfig()
        Get the client configuration.
        Returns:
        the configuration
      • setDataSource

        protected void setDataSource​(Pool<Jedis> jedisPool)
        Set the data source (pool) for this Jedis instance. This follows the original Jedis pattern for pool management.
        Parameters:
        jedisPool - the pool that manages this instance
      • close

        public void close()
        Close the connection. If this is a pooled connection, return it to the pool. Otherwise, close the underlying GLIDE client.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • getGlideClient

        protected glide.api.GlideClient getGlideClient()
        Get the underlying GLIDE client. This method is for internal use by the pool.
        Returns:
        the GLIDE client
      • isPooled

        protected boolean isPooled()
        Check if this connection is from a pool.
        Returns:
        true if pooled, false otherwise
      • resetForReuse

        protected void resetForReuse()
        Reset the closed state for pooled connections.
      • del

        public long del​(java.lang.String key)
        Delete one or more keys.
        Parameters:
        key - the key to delete
        Returns:
        the number of keys that were removed
      • del

        public long del​(java.lang.String... keys)
        Delete one or more keys.
        Parameters:
        keys - the keys to delete
        Returns:
        the number of keys that were removed
      • del

        public long del​(byte[] key)
        Delete one or more keys.
        Parameters:
        key - the key to delete
        Returns:
        the number of keys that were removed
      • del

        public long del​(byte[]... keys)
        Delete one or more keys.
        Parameters:
        keys - the keys to delete
        Returns:
        the number of keys that were removed
      • keys

        public java.util.Set<java.lang.String> keys​(java.lang.String pattern)
        Find all keys matching the given pattern.
        Parameters:
        pattern - the pattern to match (e.g., "prefix:*")
        Returns:
        a set of keys matching the pattern
      • keys

        public java.util.Set<byte[]> keys​(byte[] pattern)
        Find all keys matching the given pattern.
        Parameters:
        pattern - the pattern to match (e.g., "prefix:*")
        Returns:
        a set of keys matching the pattern
      • mset

        public java.lang.String mset​(java.lang.String... keysvalues)
        Set multiple key-value pairs.
        Parameters:
        keysvalues - alternating keys and values
        Returns:
        "OK"
      • mset

        public java.lang.String mset​(java.util.Map<java.lang.String,​java.lang.String> keyValueMap)
        Set multiple key-value pairs.
        Parameters:
        keyValueMap - map of keys to values
        Returns:
        "OK"
      • mset

        public java.lang.String mset​(byte[]... keysvalues)
        Set multiple key-value pairs.
        Parameters:
        keysvalues - alternating keys and values
        Returns:
        "OK"
      • mget

        public java.util.List<java.lang.String> mget​(java.lang.String... keys)
        Get multiple values.
        Parameters:
        keys - the keys to get
        Returns:
        list of values corresponding to the keys
      • mget

        public java.util.List<byte[]> mget​(byte[]... keys)
        Get multiple values.
        Parameters:
        keys - the keys to get
        Returns:
        list of values corresponding to the keys
      • setnx

        public long setnx​(java.lang.String key,
                          java.lang.String value)
        Set key to value if key does not exist.
        Parameters:
        key - the key
        value - the value
        Returns:
        1 if the key was set, 0 if the key already exists
      • setnx

        public long setnx​(byte[] key,
                          byte[] value)
        Set key to value only if key does not exist.
        Parameters:
        key - the key
        value - the value
        Returns:
        1 if the key was set, 0 if the key already exists
      • setex

        public java.lang.String setex​(java.lang.String key,
                                      long seconds,
                                      java.lang.String value)
        Set key to value with expiration in seconds.
        Parameters:
        key - the key
        seconds - expiration time in seconds
        value - the value
        Returns:
        "OK"
      • setex

        public java.lang.String setex​(byte[] key,
                                      long seconds,
                                      byte[] value)
        Set key to value with expiration in seconds.
        Parameters:
        key - the key
        seconds - expiration time in seconds
        value - the value
        Returns:
        "OK"
      • psetex

        public java.lang.String psetex​(java.lang.String key,
                                       long milliseconds,
                                       java.lang.String value)
        Set key to value with expiration in milliseconds.
        Parameters:
        key - the key
        milliseconds - expiration time in milliseconds
        value - the value
        Returns:
        "OK"
      • psetex

        public java.lang.String psetex​(byte[] key,
                                       long milliseconds,
                                       byte[] value)
        Set key to value with expiration in milliseconds.
        Parameters:
        key - the key
        milliseconds - expiration time in milliseconds
        value - the value
        Returns:
        "OK"
      • getSet

        @Deprecated
        public java.lang.String getSet​(java.lang.String key,
                                       java.lang.String value)
        Deprecated.
        Get old value and set new value (deprecated, use setGet instead).
        Parameters:
        key - the key
        value - the new value
        Returns:
        the old value, or null if key did not exist
      • getSet

        @Deprecated
        public byte[] getSet​(byte[] key,
                             byte[] value)
        Deprecated.
        Set new value and return old value.
        Parameters:
        key - the key
        value - the new value
        Returns:
        the old value, or null if key did not exist
      • setGet

        public java.lang.String setGet​(java.lang.String key,
                                       java.lang.String value)
        Set the string value of a key and return its old value. This is an atomic operation that combines SET and GET operations. If the key does not exist, it will be created with the new value and null will be returned.
        Parameters:
        key - the key to set
        value - the new value to set
        Returns:
        the old value stored at the key, or null if the key did not exist
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 6.2.0
      • setGet

        public byte[] setGet​(byte[] key,
                             byte[] value)
        Set the binary value of a key and return its old value. This is an atomic operation that combines SET and GET operations. If the key does not exist, it will be created with the new value and null will be returned.
        Parameters:
        key - the key to set
        value - the new binary value to set
        Returns:
        the old binary value stored at the key, or null if the key did not exist
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 6.2.0
      • setGet

        public java.lang.String setGet​(java.lang.String key,
                                       java.lang.String value,
                                       SetParams params)
        Get old value and set new value with additional parameters.
        Parameters:
        key - the key
        value - the new value
        params - additional SET parameters
        Returns:
        the old value, or null if key did not exist
      • setGet

        public byte[] setGet​(byte[] key,
                             byte[] value,
                             SetParams params)
        Get old value and set new value with additional parameters.
        Parameters:
        key - the key
        value - the new value
        params - additional SET parameters
        Returns:
        the old value, or null if key did not exist
      • getDel

        public java.lang.String getDel​(java.lang.String key)
        Get value and delete key.
        Parameters:
        key - the key
        Returns:
        the value, or null if key did not exist
      • getDel

        public byte[] getDel​(byte[] key)
        Get value and delete key.
        Parameters:
        key - the key
        Returns:
        the value, or null if key did not exist
      • getEx

        public java.lang.String getEx​(java.lang.String key,
                                      GetExParams params)
        Get the value of a key and optionally set its expiration. This command is similar to GET but allows setting expiration parameters atomically with the retrieval operation.

        The expiration can be set using various time units and formats:

        • EX seconds - Set expiration in seconds
        • PX milliseconds - Set expiration in milliseconds
        • EXAT timestamp - Set expiration as Unix timestamp in seconds
        • PXAT timestamp - Set expiration as Unix timestamp in milliseconds
        • PERSIST - Remove existing expiration
        Parameters:
        key - the key to retrieve the value from (must not be null)
        params - expiration parameters specifying how to set the key's expiration
        Returns:
        the value of the key, or null if the key does not exist
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 6.2.0
        See Also:
        GetExParams
      • getEx

        public byte[] getEx​(byte[] key,
                            GetExParams params)
        Get the binary value of a key and optionally set its expiration. This command is similar to GET but allows setting expiration parameters atomically with the retrieval operation.

        The expiration can be set using various time units and formats:

        • EX seconds - Set expiration in seconds
        • PX milliseconds - Set expiration in milliseconds
        • EXAT timestamp - Set expiration as Unix timestamp in seconds
        • PXAT timestamp - Set expiration as Unix timestamp in milliseconds
        • PERSIST - Remove existing expiration
        Parameters:
        key - the key to retrieve the value from (must not be null)
        params - expiration parameters specifying how to set the key's expiration
        Returns:
        the binary value of the key, or null if the key does not exist
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 6.2.0
        See Also:
        GetExParams
      • append

        public long append​(java.lang.String key,
                           java.lang.String value)
        Append a value to the end of the string stored at the specified key. If the key does not exist, it is created and set as an empty string before performing the append operation. This operation is atomic and efficient for building strings incrementally.

        This command is useful for:

        • Building log entries or messages incrementally
        • Concatenating strings without retrieving the current value
        • Implementing counters or accumulators in string format
        Parameters:
        key - the key where the string is stored (must not be null)
        value - the value to append to the existing string (must not be null)
        Returns:
        the length of the string after the append operation (includes both original and appended content)
        Throws:
        JedisException - if the operation fails or if the key contains a non-string value
        Since:
        Valkey 2.0.0
      • append

        public long append​(byte[] key,
                           byte[] value)
        Append a binary value to the end of the string stored at the specified key. If the key does not exist, it is created and set as an empty string before performing the append operation. This operation is atomic and efficient for building binary strings incrementally.

        This command is useful for:

        • Building binary log entries or data incrementally
        • Concatenating binary data without retrieving the current value
        • Implementing binary accumulators or buffers
        Parameters:
        key - the key where the binary string is stored (must not be null)
        value - the binary value to append to the existing string (must not be null)
        Returns:
        the length of the string after the append operation (includes both original and appended content)
        Throws:
        JedisException - if the operation fails or if the key contains a non-string value
        Since:
        Valkey 2.0.0
      • strlen

        public long strlen​(java.lang.String key)
        Get the length of the string value stored at key.
        Parameters:
        key - the key
        Returns:
        the length of the string, or 0 if key does not exist
      • strlen

        public long strlen​(byte[] key)
        Get the length of the string value stored at key.
        Parameters:
        key - the key
        Returns:
        the length of the string, or 0 if key does not exist
      • incr

        public long incr​(java.lang.String key)
        Increment the integer value of key by 1.
        Parameters:
        key - the key
        Returns:
        the value after increment
      • incr

        public long incr​(byte[] key)
        Increment the integer value of key by 1.
        Parameters:
        key - the key
        Returns:
        the value after increment
      • incrBy

        public long incrBy​(java.lang.String key,
                           long increment)
        Increment the integer value of key by amount.
        Parameters:
        key - the key
        increment - the amount to increment by
        Returns:
        the value after increment
      • incrByFloat

        public double incrByFloat​(java.lang.String key,
                                  double increment)
        Increment the float value of key by amount.
        Parameters:
        key - the key
        increment - the amount to increment by
        Returns:
        the value after increment
      • incrBy

        public long incrBy​(byte[] key,
                           long increment)
        Increment the integer value of a key by the given amount (alternative method name).
        Parameters:
        key - the key
        increment - the increment value
        Returns:
        the value after increment
      • incrByFloat

        public double incrByFloat​(byte[] key,
                                  double increment)
        Increment the float value of a key by the given amount.
        Parameters:
        key - the key
        increment - the increment value
        Returns:
        the value after increment
      • decr

        public long decr​(java.lang.String key)
        Decrement the integer value of key by 1.
        Parameters:
        key - the key
        Returns:
        the value after decrement
      • decr

        public long decr​(byte[] key)
        Decrement the integer value of key by 1.
        Parameters:
        key - the key
        Returns:
        the value after decrement
      • decrBy

        public long decrBy​(java.lang.String key,
                           long decrement)
        Decrement the integer value of key by amount.
        Parameters:
        key - the key
        decrement - the amount to decrement by
        Returns:
        the value after decrement
      • decrBy

        public long decrBy​(byte[] key,
                           long decrement)
        Decrement the integer value of a key by the given amount (alternative method name).
        Parameters:
        key - the key
        decrement - the decrement value
        Returns:
        the value after decrement
      • unlink

        public long unlink​(java.lang.String... keys)
        Asynchronously delete one or more keys.
        Parameters:
        keys - the keys to delete
        Returns:
        the number of keys that were removed
      • unlink

        public long unlink​(byte[] key)
        Asynchronously delete a key.
        Parameters:
        key - the key to delete
        Returns:
        the number of keys that were removed
      • unlink

        public long unlink​(byte[]... keys)
        Asynchronously delete one or more keys.
        Parameters:
        keys - the keys to delete
        Returns:
        the number of keys that were removed
      • exists

        public long exists​(java.lang.String... keys)
        Check if one or more keys exist.
        Parameters:
        keys - the keys to check
        Returns:
        the number of keys that exist
      • exists

        public boolean exists​(byte[] key)
        Check if a key exists.
        Parameters:
        key - the key to check
        Returns:
        true if the key exists, false otherwise
      • exists

        public boolean exists​(java.lang.String key)
        Check if a key exists.
        Parameters:
        key - the key to check
        Returns:
        true if the key exists, false otherwise
      • keyExists

        public boolean keyExists​(java.lang.String key)
        Check if a key exists (boolean version for Jedis compatibility).
        Parameters:
        key - the key to check
        Returns:
        true if the key exists, false otherwise
      • keyExists

        public boolean keyExists​(byte[] key)
        Check if a key exists (boolean version for Jedis compatibility).
        Parameters:
        key - the key to check
        Returns:
        true if the key exists, false otherwise
      • exists

        public long exists​(byte[]... keys)
        Check if one or more keys exist.
        Parameters:
        keys - the keys to check
        Returns:
        the number of keys that exist
      • type

        public java.lang.String type​(java.lang.String key)
        Get the type of a key.
        Parameters:
        key - the key
        Returns:
        the type of the key
      • type

        public java.lang.String type​(byte[] key)
        Get the type of a key.
        Parameters:
        key - the key
        Returns:
        the type of the key
      • randomKey

        public java.lang.String randomKey()
        Get a random key from the currently selected database. This command is useful for sampling keys from the database. The key is selected uniformly at random.
        Returns:
        a random key from the database, or null if the database is empty
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 1.0.0
      • rename

        public java.lang.String rename​(java.lang.String oldkey,
                                       java.lang.String newkey)
        Rename a key.
        Parameters:
        oldkey - the old key name
        newkey - the new key name
        Returns:
        "OK"
      • rename

        public java.lang.String rename​(byte[] oldkey,
                                       byte[] newkey)
        Rename a key.
        Parameters:
        oldkey - the old key name
        newkey - the new key name
        Returns:
        "OK"
      • renamenx

        public long renamenx​(java.lang.String oldkey,
                             java.lang.String newkey)
        Rename a key if the new key does not exist.
        Parameters:
        oldkey - the old key name
        newkey - the new key name
        Returns:
        1 if the key was renamed, 0 if the new key already exists
      • renamenx

        public long renamenx​(byte[] oldkey,
                             byte[] newkey)
        Rename a key if the new key does not exist.
        Parameters:
        oldkey - the old key name
        newkey - the new key name
        Returns:
        1 if the key was renamed, 0 if the new key already exists
      • expire

        public long expire​(java.lang.String key,
                           long seconds)
        Set expiration time in seconds.
        Parameters:
        key - the key
        seconds - expiration time in seconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • expire

        public long expire​(byte[] key,
                           long seconds)
        Set expiration time in seconds.
        Parameters:
        key - the key
        seconds - expiration time in seconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • expire

        public long expire​(byte[] key,
                           long seconds,
                           ExpiryOption expiryOption)
        Set expiration time in seconds with expiry option.
        Parameters:
        key - the key
        seconds - expiration time in seconds
        expiryOption - the expiry option
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • expire

        public long expire​(java.lang.String key,
                           long seconds,
                           ExpiryOption expiryOption)
        Set expiration time in seconds with expiry option.
        Parameters:
        key - the key
        seconds - expiration time in seconds
        expiryOption - the expiry option
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • expireAt

        public long expireAt​(java.lang.String key,
                             long unixTime)
        Set the expiration time of a key as a Unix timestamp (seconds since January 1, 1970). The key will be automatically deleted when the specified time is reached.
        Parameters:
        key - the key to set expiration for (must not be null)
        unixTime - expiration timestamp in seconds since Unix epoch
        Returns:
        1 if the expiration was set successfully, 0 if the key does not exist
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 1.2.0
      • expireAt

        public long expireAt​(byte[] key,
                             long unixTime)
        Set expiration time at a specific timestamp.
        Parameters:
        key - the key
        unixTime - expiration timestamp in seconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • expireAt

        public long expireAt​(java.lang.String key,
                             long unixTime,
                             ExpiryOption expiryOption)
        Set expiration time at a specific timestamp with expiry option.
        Parameters:
        key - the key
        unixTime - expiration timestamp in seconds
        expiryOption - expiry option (NX, XX, GT, LT)
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • expireAt

        public long expireAt​(byte[] key,
                             long unixTime,
                             ExpiryOption expiryOption)
        Set expiration time at a specific timestamp with expiry option.
        Parameters:
        key - the key
        unixTime - expiration timestamp in seconds
        expiryOption - expiry option (NX, XX, GT, LT)
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • pexpire

        public long pexpire​(java.lang.String key,
                            long milliseconds)
        Set expiration time in milliseconds.
        Parameters:
        key - the key
        milliseconds - expiration time in milliseconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • pexpire

        public long pexpire​(byte[] key,
                            long milliseconds)
        Set expiration time in milliseconds.
        Parameters:
        key - the key
        milliseconds - expiration time in milliseconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • pexpire

        public long pexpire​(byte[] key,
                            long milliseconds,
                            ExpiryOption expiryOption)
        Set expiration time in milliseconds with expiry option.
        Parameters:
        key - the key
        milliseconds - expiration time in milliseconds
        expiryOption - the expiry option
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • pexpire

        public long pexpire​(java.lang.String key,
                            long milliseconds,
                            ExpiryOption expiryOption)
        Set expiration time in milliseconds with expiry option.
        Parameters:
        key - the key
        milliseconds - expiration time in milliseconds
        expiryOption - the expiry option
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • pexpireAt

        public long pexpireAt​(java.lang.String key,
                              long millisecondsTimestamp)
        Set expiration time at a specific millisecond timestamp.
        Parameters:
        key - the key
        millisecondsTimestamp - expiration timestamp in milliseconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • pexpireAt

        public long pexpireAt​(byte[] key,
                              long millisecondsTimestamp)
        Set expiration time at a specific millisecond timestamp.
        Parameters:
        key - the key
        millisecondsTimestamp - expiration timestamp in milliseconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • pexpireAt

        public long pexpireAt​(java.lang.String key,
                              long millisecondsTimestamp,
                              ExpiryOption expiryOption)
        Set expiration time at a specific millisecond timestamp with expiry option.
        Parameters:
        key - the key
        millisecondsTimestamp - expiration timestamp in milliseconds
        expiryOption - expiry option (NX, XX, GT, LT)
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • pexpireAt

        public long pexpireAt​(byte[] key,
                              long millisecondsTimestamp,
                              ExpiryOption expiryOption)
        Set expiration time at a specific millisecond timestamp with expiry option.
        Parameters:
        key - the key
        millisecondsTimestamp - expiration timestamp in milliseconds
        expiryOption - expiry option (NX, XX, GT, LT)
        Returns:
        1 if expiration was set, 0 if key does not exist or condition not met
      • expireTime

        public long expireTime​(java.lang.String key)
        Get the expiration timestamp of a key in seconds.
        Parameters:
        key - the key
        Returns:
        expiration timestamp in seconds, or -1 if key has no expiration, -2 if key does not exist
      • pexpireTime

        public long pexpireTime​(java.lang.String key)
        Get the expiration timestamp of a key in milliseconds.
        Parameters:
        key - the key
        Returns:
        expiration timestamp in milliseconds, or -1 if key has no expiration, -2 if key does not exist
      • pexpireat

        public long pexpireat​(byte[] key,
                              long millisecondsTimestamp)
        Set expiration time at a specific timestamp in milliseconds.
        Parameters:
        key - the key
        millisecondsTimestamp - expiration timestamp in milliseconds
        Returns:
        1 if expiration was set, 0 if key does not exist
      • expireTime

        public long expireTime​(byte[] key)
        Get the expiration timestamp of a key in seconds.
        Parameters:
        key - the key
        Returns:
        expiration timestamp in seconds, or -1 if key has no expiration, -2 if key does not exist
      • pexpireTime

        public long pexpireTime​(byte[] key)
        Get the expiration timestamp of a key in milliseconds.
        Parameters:
        key - the key
        Returns:
        expiration timestamp in milliseconds, or -1 if key has no expiration, -2 if key does not exist
      • ttl

        public long ttl​(java.lang.String key)
        Get the time to live of a key in seconds.
        Parameters:
        key - the key
        Returns:
        time to live in seconds, or -1 if key has no expiration, -2 if key does not exist
      • ttl

        public long ttl​(byte[] key)
        Get the time to live of a key in seconds.
        Parameters:
        key - the key
        Returns:
        time to live in seconds, or -1 if key has no expiration, -2 if key does not exist
      • pttl

        public long pttl​(java.lang.String key)
        Get the time to live of a key in milliseconds.
        Parameters:
        key - the key
        Returns:
        time to live in milliseconds, or -1 if key has no expiration, -2 if key does not exist
      • pttl

        public long pttl​(byte[] key)
        Get the time to live of a key in milliseconds.
        Parameters:
        key - the key
        Returns:
        time to live in milliseconds, or -1 if key has no expiration, -2 if key does not exist
      • persist

        public long persist​(java.lang.String key)
        Remove the expiration from a key.
        Parameters:
        key - the key
        Returns:
        1 if expiration was removed, 0 if key does not exist or has no expiration
      • persist

        public long persist​(byte[] key)
        Remove the expiration from a key.
        Parameters:
        key - the key
        Returns:
        1 if expiration was removed, 0 if key does not exist or has no expiration
      • sort

        public java.util.List<java.lang.String> sort​(java.lang.String key)
        Sort the elements in a list, set, or sorted set.
        Parameters:
        key - the key
        Returns:
        the sorted elements
      • sort

        public java.util.List<java.lang.String> sort​(java.lang.String key,
                                                     java.lang.String... sortingParameters)
        Sort the elements in a list, set, or sorted set with options.
        Parameters:
        key - the key
        sortingParameters - sorting parameters (BY, LIMIT, GET, ASC/DESC, ALPHA)
        Returns:
        the sorted elements
      • dump

        public byte[] dump​(java.lang.String key)
        Serialize a key's value.
        Parameters:
        key - the key
        Returns:
        the serialized value, or null if key does not exist
      • dump

        public byte[] dump​(byte[] key)
        Serialize a key's value.
        Parameters:
        key - the key
        Returns:
        the serialized value, or null if key does not exist
      • restore

        public java.lang.String restore​(java.lang.String key,
                                        long ttl,
                                        byte[] serializedValue)
        Deserialize a value and store it at a key.
        Parameters:
        key - the key
        ttl - time to live in milliseconds (0 for no expiration)
        serializedValue - the serialized value
        Returns:
        "OK"
      • migrate

        public java.lang.String migrate​(java.lang.String host,
                                        int port,
                                        java.lang.String key,
                                        int destinationDb,
                                        int timeout)
        Move a key to another Valkey instance.
        Parameters:
        host - destination host
        port - destination port
        key - the key to migrate
        destinationDb - destination database
        timeout - timeout in milliseconds
        Returns:
        "OK" or "NOKEY"
      • move

        public long move​(java.lang.String key,
                         int dbIndex)
        Move a key to another database.
        Parameters:
        key - the key
        dbIndex - destination database index
        Returns:
        1 if key was moved, 0 if key does not exist or already exists in target database
      • move

        public long move​(byte[] key,
                         int dbIndex)
        Move a key to another database.
        Parameters:
        key - the key
        dbIndex - destination database index
        Returns:
        1 if key was moved, 0 if key does not exist or already exists in target database
      • scan

        public ScanResult<java.lang.String> scan​(java.lang.String cursor,
                                                 ScanParams params)
        Iterate over keys in the database with scan parameters.
        Parameters:
        cursor - the cursor
        params - the scan parameters
        Returns:
        scan result with new cursor and keys
      • scan

        public ScanResult<byte[]> scan​(byte[] cursor,
                                       ScanParams params)
        Iterate over keys in the database with scan parameters.
        Parameters:
        cursor - the cursor
        params - the scan parameters
        Returns:
        scan result with new cursor and keys
      • scan

        public ScanResult<byte[]> scan​(byte[] cursor)
        Iterate over keys in the database.
        Parameters:
        cursor - the cursor
        Returns:
        scan result with new cursor and keys
      • scan

        public ScanResult<java.lang.String> scan​(java.lang.String cursor)
        Iterate over keys in the database.
        Parameters:
        cursor - the cursor
        Returns:
        scan result with new cursor and keys
      • scan

        public ScanResult<java.lang.String> scan​(java.lang.String cursor,
                                                 ScanParams params,
                                                 java.lang.String type)
        Iterate over keys in the database with scan parameters and type filter.
        Parameters:
        cursor - the cursor
        params - the scan parameters
        type - the type filter
        Returns:
        scan result with new cursor and keys
      • scan

        public ScanResult<byte[]> scan​(byte[] cursor,
                                       ScanParams params,
                                       byte[] type)
        Iterate over keys in the database with scan parameters and type filter.
        Parameters:
        cursor - the cursor
        params - the scan parameters
        type - the type filter
        Returns:
        scan result with new cursor and keys
      • touch

        public long touch​(java.lang.String... keys)
        Update the last access time of keys.
        Parameters:
        keys - the keys to touch
        Returns:
        the number of keys that were touched
      • touch

        public long touch​(byte[] key)
        Update the last access time of a key.
        Parameters:
        key - the key to touch
        Returns:
        the number of keys that were touched
      • touch

        public long touch​(byte[]... keys)
        Update the last access time of keys.
        Parameters:
        keys - the keys to touch
        Returns:
        the number of keys that were touched
      • copy

        public boolean copy​(java.lang.String srcKey,
                            java.lang.String dstKey,
                            boolean replace)
        Copy a key to another key.
        Parameters:
        srcKey - source key
        dstKey - destination key
        replace - whether to replace the destination key if it exists
        Returns:
        true if key was copied, false if source key does not exist or destination exists and replace is false
      • copy

        public boolean copy​(byte[] srcKey,
                            byte[] dstKey,
                            boolean replace)
        Copy a key to another key.
        Parameters:
        srcKey - source key
        dstKey - destination key
        replace - whether to replace the destination key if it exists
        Returns:
        true if key was copied, false if source key does not exist or destination exists and replace is false
      • copy

        public boolean copy​(java.lang.String srcKey,
                            java.lang.String dstKey,
                            int db,
                            boolean replace)
        Copy a key to another key in a different database.
        Parameters:
        srcKey - source key
        dstKey - destination key
        db - destination database index
        replace - whether to replace the destination key if it exists
        Returns:
        true if key was copied, false if source key does not exist or destination exists and replace is false
      • copy

        public boolean copy​(byte[] srcKey,
                            byte[] dstKey,
                            int db,
                            boolean replace)
        Copy a key to another key in a different database.
        Parameters:
        srcKey - source key
        dstKey - destination key
        db - destination database index
        replace - whether to replace the destination key if it exists
        Returns:
        true if key was copied, false if source key does not exist or destination exists and replace is false
      • setbit

        public boolean setbit​(java.lang.String key,
                              long offset,
                              boolean value)
        Sets or clears the bit at offset in the string value stored at key.
        Parameters:
        key - the key
        offset - the bit offset
        value - the bit value (true for 1, false for 0)
        Returns:
        the original bit value stored at offset
      • setbit

        public boolean setbit​(byte[] key,
                              long offset,
                              boolean value)
        Sets or clears the bit at offset in the string value stored at key.
        Parameters:
        key - the key
        offset - the bit offset
        value - the bit value (true for 1, false for 0)
        Returns:
        the original bit value stored at offset
      • getbit

        public boolean getbit​(java.lang.String key,
                              long offset)
        Returns the bit value at offset in the string value stored at key.
        Parameters:
        key - the key
        offset - the bit offset
        Returns:
        the bit value stored at offset
      • getbit

        public boolean getbit​(byte[] key,
                              long offset)
        Returns the bit value at offset in the string value stored at key.
        Parameters:
        key - the key
        offset - the bit offset
        Returns:
        the bit value stored at offset
      • bitcount

        public long bitcount​(java.lang.String key)
        Count the number of set bits (population counting) in a string. This operation counts all bits set to 1 in the entire string value stored at the specified key.
        Parameters:
        key - the key containing the string value to analyze
        Returns:
        the number of bits set to 1 (0 if key doesn't exist)
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.6.0
      • bitcount

        public long bitcount​(java.lang.String key,
                             long start,
                             long end)
        Count the number of set bits (population counting) in a string within a specified byte range. The range is specified by start and end byte offsets (inclusive).
        Parameters:
        key - the key containing the string value to analyze
        start - the start offset (byte index, can be negative for end-relative indexing)
        end - the end offset (byte index, can be negative for end-relative indexing)
        Returns:
        the number of bits set to 1 within the specified range
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.6.0
      • bitcount

        public long bitcount​(byte[] key)
        Count the number of set bits in a string.
        Parameters:
        key - the key
        Returns:
        the number of bits set to 1
      • bitcount

        public long bitcount​(byte[] key,
                             long start,
                             long end)
        Count the number of set bits in a string at a range.
        Parameters:
        key - the key
        start - the start offset (byte index)
        end - the end offset (byte index)
        Returns:
        the number of bits set to 1
      • bitcount

        public long bitcount​(byte[] key,
                             long start,
                             long end,
                             BitCountOption option)
        Count the number of set bits in a string at a range with bit count option.
        Parameters:
        key - the key
        start - the start offset
        end - the end offset
        option - the bit count option (BYTE or BIT)
        Returns:
        the number of bits set to 1
      • bitcount

        public long bitcount​(java.lang.String key,
                             long start,
                             long end,
                             BitCountOption option)
        Count the number of set bits in a string at a range with bit count option.
        Parameters:
        key - the key
        start - the start offset
        end - the end offset
        option - the bit count option (BYTE or BIT)
        Returns:
        the number of bits set to 1
      • bitpos

        public long bitpos​(java.lang.String key,
                           boolean value)
        Return the position of the first bit set to 1 or 0 in a string.
        Parameters:
        key - the key
        value - the bit value to search for (true for 1, false for 0)
        Returns:
        the position of the first bit set to the specified value, or -1 if not found
      • bitpos

        public long bitpos​(byte[] key,
                           boolean value)
        Return the position of the first bit set to 1 or 0 in a string within a range.
        Parameters:
        key - the key
        value - the bit value to search for (true for 1, false for 0) /** Return the position of the first bit set to 1 or 0 in a string.
        key - the key
        value - the bit value to search for (true for 1, false for 0)
        Returns:
        the position of the first bit set to the specified value, or -1 if not found
      • bitpos

        public long bitpos​(java.lang.String key,
                           boolean value,
                           BitPosParams params)
        /** Return the position of the first bit set to 1 or 0 in a string with parameters.
        Parameters:
        key - the key
        value - the bit value to search for (true for 1, false for 0)
        params - the bitpos parameters
        Returns:
        the position of the first bit set to the specified value, or -1 if not found
      • bitpos

        public long bitpos​(byte[] key,
                           boolean value,
                           BitPosParams params)
        Return the position of the first bit set to 1 or 0 in a string with parameters.
        Parameters:
        key - the key
        value - the bit value to search for (true for 1, false for 0)
        params - the bitpos parameters
        Returns:
        the position of the first bit set to the specified value, or -1 if not found
      • bitop

        public long bitop​(BitOP op,
                          java.lang.String destKey,
                          java.lang.String... srcKeys)
        Perform bitwise operations between strings.
        Parameters:
        op - the bitwise operation (AND, OR, XOR, NOT)
        destKey - the destination key where the result will be stored
        srcKeys - the source keys for the bitwise operation
        Returns:
        the size of the string stored in the destination key
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.6.0
      • bitop

        public long bitop​(BitOP op,
                          byte[] destKey,
                          byte[]... srcKeys)
        Perform bitwise operations between strings.
        Parameters:
        op - the bitwise operation (AND, OR, XOR, NOT)
        destKey - the destination key where the result will be stored
        srcKeys - the source keys for the bitwise operation
        Returns:
        the size of the string stored in the destination key
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.6.0
      • bitfield

        public java.util.List<java.lang.Long> bitfield​(java.lang.String key,
                                                       java.lang.String... arguments)
        Perform multiple bitfield operations on a string.
        Parameters:
        key - the key
        arguments - the bitfield arguments
        Returns:
        list of results from the bitfield operations
      • bitfield

        public java.util.List<java.lang.Long> bitfield​(byte[] key,
                                                       byte[]... arguments)
        Perform multiple bitfield operations on a string.
        Parameters:
        key - the key
        arguments - the bitfield arguments
        Returns:
        list of results from the bitfield operations
      • bitfieldReadonly

        public java.util.List<java.lang.Long> bitfieldReadonly​(java.lang.String key,
                                                               java.lang.String... arguments)
        Perform read-only bitfield operations on a string.
        Parameters:
        key - the key
        arguments - the bitfield arguments
        Returns:
        list of results from the bitfield operations
      • bitfieldReadonly

        public java.util.List<java.lang.Long> bitfieldReadonly​(byte[] key,
                                                               byte[]... arguments)
        Perform read-only bitfield operations on a string.
        Parameters:
        key - the key
        arguments - the bitfield arguments
        Returns:
        list of results from the bitfield operations
      • pfadd

        public long pfadd​(java.lang.String key,
                          java.lang.String... elements)
        Adds all elements to the HyperLogLog data structure stored at the specified key. Creates a new structure if the key does not exist. HyperLogLog is a probabilistic data structure used for estimating the cardinality of large datasets.
        Parameters:
        key - the key of the HyperLogLog data structure
        elements - the elements to add to the HyperLogLog (must not be null)
        Returns:
        1 if the HyperLogLog is newly created or modified, 0 otherwise
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.8.9
      • pfadd

        public long pfadd​(byte[] key,
                          byte[]... elements)
        Adds all elements to the HyperLogLog data structure stored at the specified key. Creates a new structure if the key does not exist. HyperLogLog is a probabilistic data structure used for estimating the cardinality of large datasets.
        Parameters:
        key - the key of the HyperLogLog data structure
        elements - the elements to add to the HyperLogLog (must not be null)
        Returns:
        1 if the HyperLogLog is newly created or modified, 0 otherwise
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.8.9
      • pfcount

        public long pfcount​(java.lang.String key)
        Estimates the cardinality of the data stored in a HyperLogLog structure for a single key. The cardinality is the approximate number of unique elements that have been added to the set.
        Parameters:
        key - the key of the HyperLogLog data structure
        Returns:
        the approximated cardinality of the HyperLogLog data structure (0 if key doesn't exist)
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.8.9
      • pfcount

        public long pfcount​(java.lang.String... keys)
        Estimates the cardinality of the data stored in multiple HyperLogLog structures by calculating the combined cardinality of multiple keys. This operation is equivalent to performing a union of the HyperLogLog structures and then counting the cardinality.
        Parameters:
        keys - the keys of the HyperLogLog data structures to be analyzed (must not be empty)
        Returns:
        the approximated cardinality of the combined HyperLogLog data structures
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.8.9
      • pfmerge

        public java.lang.String pfmerge​(java.lang.String destKey,
                                        java.lang.String... sourceKeys)
        Merges multiple HyperLogLog values into a unique value. If the destination variable exists, it is treated as one of the source HyperLogLog data sets, otherwise a new HyperLogLog is created.
        Parameters:
        destKey - the key of the destination HyperLogLog where the merged data sets will be stored
        sourceKeys - the keys of the HyperLogLog structures to be merged
        Returns:
        "OK" if successful
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.8.9
      • pfcount

        public long pfcount​(byte[] key)
        Estimates the cardinality of the data stored in a HyperLogLog structure for a single key.
        Parameters:
        key - the key of the HyperLogLog data structure
        Returns:
        the approximated cardinality of the HyperLogLog data structure
      • pfcount

        public long pfcount​(byte[]... keys)
        Estimates the cardinality of the union of multiple HyperLogLog data structures.
        Parameters:
        keys - the keys of the HyperLogLog data structures
        Returns:
        the approximated cardinality of the union of the HyperLogLog data structures
      • pfmerge

        public java.lang.String pfmerge​(byte[] destKey,
                                        byte[]... sourceKeys)
        Merges multiple HyperLogLog values into a unique value. If the destination variable exists, it is treated as one of the source HyperLogLog data sets, otherwise a new HyperLogLog is created.
        Parameters:
        destKey - the key of the destination HyperLogLog where the merged data sets will be stored
        sourceKeys - the keys of the HyperLogLog structures to be merged
        Returns:
        "OK" if successful
        Throws:
        JedisException - if the operation fails
        Since:
        Valkey 2.8.9
      • sendCommand

        public java.lang.Object sendCommand​(ProtocolCommand cmd,
                                            byte[]... args)
        Sends a Valkey command using the GLIDE client with full compatibility to original Jedis.

        This method provides complete compatibility with the original Jedis sendCommand functionality by using GLIDE's customCommand directly.

        Compatibility Note: This method provides full compatibility with original Jedis sendCommand behavior. All Valkey commands and their optional arguments are supported through GLIDE's customCommand.

        Parameters:
        cmd - the Valkey command to execute
        args - the command arguments as byte arrays
        Returns:
        the command response from GLIDE customCommand
        Throws:
        JedisException - if the command fails or is not supported
        java.lang.UnsupportedOperationException - if the command is not supported in the compatibility layer
      • sendCommand

        public java.lang.Object sendCommand​(ProtocolCommand cmd,
                                            java.lang.String... args)
        Sends a command to the Valkey server with string arguments.

        Compatibility Note: This method provides full compatibility with original Jedis sendCommand functionality. All Valkey commands and their optional arguments are supported.

        Parameters:
        cmd - the Valkey command to execute
        args - the command arguments as strings
        Returns:
        the command response from GLIDE customCommand
        Throws:
        JedisException - if the command fails or is not supported
        java.lang.UnsupportedOperationException - if the command is not supported in the compatibility layer
      • sendCommand

        public java.lang.Object sendCommand​(ProtocolCommand cmd)
        Sends a command to the Valkey server without arguments.

        Compatibility Note: This method provides full compatibility with original Jedis sendCommand functionality. All Valkey commands are supported.

        Parameters:
        cmd - the Valkey command to execute
        Returns:
        the command response from GLIDE customCommand
        Throws:
        JedisException - if the command fails or is not supported
        java.lang.UnsupportedOperationException - if the command is not supported in the compatibility layer
      • hset

        public long hset​(java.lang.String key,
                         java.lang.String field,
                         java.lang.String value)
        Sets the specified field in the hash stored at key to value.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the value to set
        Returns:
        1 if field is a new field in the hash and value was set, 0 if field already exists in the hash and the value was updated
      • hset

        public long hset​(byte[] key,
                         byte[] field,
                         byte[] value)
        Sets the specified field in the hash stored at key to value (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the value to set
        Returns:
        1 if field is a new field in the hash and value was set, 0 if field already exists in the hash and the value was updated
      • hset

        public long hset​(java.lang.String key,
                         java.util.Map<java.lang.String,​java.lang.String> hash)
        Sets the specified fields to their respective values in the hash stored at key.
        Parameters:
        key - the key of the hash
        hash - a map of field-value pairs to set in the hash
        Returns:
        the number of fields that were added
      • hset

        public long hset​(byte[] key,
                         java.util.Map<byte[],​byte[]> hash)
        Sets the specified fields to their respective values in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        hash - a map of field-value pairs to set in the hash
        Returns:
        the number of fields that were added
      • hget

        public java.lang.String hget​(java.lang.String key,
                                     java.lang.String field)
        Returns the value associated with field in the hash stored at key.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        Returns:
        the value associated with field, or null when field is not present in the hash or key does not exist
      • hget

        public byte[] hget​(byte[] key,
                           byte[] field)
        Returns the value associated with field in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        Returns:
        the value associated with field, or null when field is not present in the hash or key does not exist
      • hmset

        public java.lang.String hmset​(java.lang.String key,
                                      java.util.Map<java.lang.String,​java.lang.String> hash)
        Sets the specified fields to their respective values in the hash stored at key. This command overwrites any specified fields already existing in the hash.
        Parameters:
        key - the key of the hash
        hash - a map of field-value pairs to set in the hash
        Returns:
        "OK"
      • hmset

        public java.lang.String hmset​(byte[] key,
                                      java.util.Map<byte[],​byte[]> hash)
        Sets the specified fields to their respective values in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        hash - a map of field-value pairs to set in the hash
        Returns:
        "OK"
      • hmget

        public java.util.List<java.lang.String> hmget​(java.lang.String key,
                                                      java.lang.String... fields)
        Returns the values associated with the specified fields in the hash stored at key.
        Parameters:
        key - the key of the hash
        fields - the fields in the hash
        Returns:
        a list of values associated with the given fields, in the same order as they are requested
      • hmget

        public java.util.List<byte[]> hmget​(byte[] key,
                                            byte[]... fields)
        Returns the values associated with the specified fields in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        fields - the fields in the hash
        Returns:
        a list of values associated with the given fields, in the same order as they are requested
      • hgetAll

        public java.util.Map<java.lang.String,​java.lang.String> hgetAll​(java.lang.String key)
        Returns all fields and values of the hash stored at key.
        Parameters:
        key - the key of the hash
        Returns:
        a map of fields and their values stored in the hash, or an empty map when key does not exist
      • hgetAll

        public java.util.Map<byte[],​byte[]> hgetAll​(byte[] key)
        Returns all fields and values of the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        Returns:
        a map of fields and their values stored in the hash, or an empty map when key does not exist
      • hdel

        public long hdel​(java.lang.String key,
                         java.lang.String... fields)
        Removes the specified fields from the hash stored at key.
        Parameters:
        key - the key of the hash
        fields - the fields to remove from the hash
        Returns:
        the number of fields that were removed from the hash, not including specified but non existing fields
      • hdel

        public long hdel​(byte[] key,
                         byte[]... fields)
        Removes the specified fields from the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        fields - the fields to remove from the hash
        Returns:
        the number of fields that were removed from the hash, not including specified but non existing fields
      • hexists

        public boolean hexists​(java.lang.String key,
                               java.lang.String field)
        Returns if field is an existing field in the hash stored at key.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        Returns:
        true if the hash contains field, false if the hash does not contain field, or key does not exist
      • hexists

        public boolean hexists​(byte[] key,
                               byte[] field)
        Returns if field is an existing field in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        Returns:
        true if the hash contains field, false if the hash does not contain field, or key does not exist
      • hlen

        public long hlen​(java.lang.String key)
        Returns the number of fields contained in the hash stored at key.
        Parameters:
        key - the key of the hash
        Returns:
        the number of fields in the hash, or 0 when key does not exist
      • hlen

        public long hlen​(byte[] key)
        Returns the number of fields contained in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        Returns:
        the number of fields in the hash, or 0 when key does not exist
      • hkeys

        public java.util.Set<java.lang.String> hkeys​(java.lang.String key)
        Returns all field names in the hash stored at key.
        Parameters:
        key - the key of the hash
        Returns:
        a set of field names in the hash, or an empty set when key does not exist
      • hkeys

        public java.util.Set<byte[]> hkeys​(byte[] key)
        Returns all field names in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        Returns:
        a set of field names in the hash, or an empty set when key does not exist
      • hvals

        public java.util.List<java.lang.String> hvals​(java.lang.String key)
        Returns all values in the hash stored at key.
        Parameters:
        key - the key of the hash
        Returns:
        a list of values in the hash, or an empty list when key does not exist
      • hvals

        public java.util.List<byte[]> hvals​(byte[] key)
        Returns all values in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        Returns:
        a list of values in the hash, or an empty list when key does not exist
      • hincrBy

        public long hincrBy​(java.lang.String key,
                            java.lang.String field,
                            long value)
        Increments the number stored at field in the hash stored at key by increment.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the increment value
        Returns:
        the value at field after the increment operation
      • hincrBy

        public long hincrBy​(byte[] key,
                            byte[] field,
                            long value)
        Increments the number stored at field in the hash stored at key by increment (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the increment value
        Returns:
        the value at field after the increment operation
      • hincrByFloat

        public double hincrByFloat​(java.lang.String key,
                                   java.lang.String field,
                                   double value)
        Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the increment value
        Returns:
        the value at field after the increment operation
      • hincrByFloat

        public double hincrByFloat​(byte[] key,
                                   byte[] field,
                                   double value)
        Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the increment value
        Returns:
        the value at field after the increment operation
      • hsetnx

        public long hsetnx​(java.lang.String key,
                           java.lang.String field,
                           java.lang.String value)
        Sets field in the hash stored at key to value, only if field does not yet exist.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the value to set
        Returns:
        1 if field is a new field in the hash and value was set, 0 if field already exists in the hash and no operation was performed
      • hsetnx

        public long hsetnx​(byte[] key,
                           byte[] field,
                           byte[] value)
        Sets field in the hash stored at key to value, only if field does not yet exist (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        value - the value to set
        Returns:
        1 if field is a new field in the hash and value was set, 0 if field already exists in the hash and no operation was performed
      • hstrlen

        public long hstrlen​(java.lang.String key,
                            java.lang.String field)
        Returns the string length of the value associated with field in the hash stored at key.
        Parameters:
        key - the key of the hash
        field - the field in the hash
        Returns:
        the string length of the value associated with field, or 0 when field is not present in the hash or key does not exist
      • hstrlen

        public long hstrlen​(byte[] key,
                            byte[] field)
        Returns the string length of the value associated with field in the hash stored at key (binary version).
        Parameters:
        key - the key of the hash
        field - the field in the hash
        Returns:
        the string length of the value associated with field, or 0 when field is not present in the hash or key does not exist
      • hrandfield

        public java.lang.String hrandfield​(java.lang.String key)
        Returns a random field from the hash value stored at key.
        Parameters:
        key - the key of the hash
        Returns:
        a random field from the hash, or null when key does not exist
      • hrandfield

        public byte[] hrandfield​(byte[] key)
        Returns a random field from the hash value stored at key (binary version).
        Parameters:
        key - the key of the hash
        Returns:
        a random field from the hash, or null when key does not exist
      • hrandfield

        public java.util.List<java.lang.String> hrandfield​(java.lang.String key,
                                                           long count)
        Returns an array of random fields from the hash value stored at key.
        Parameters:
        key - the key of the hash
        count - the number of fields to return
        Returns:
        an array of random fields from the hash
      • hrandfield

        public java.util.List<byte[]> hrandfield​(byte[] key,
                                                 long count)
        Returns an array of random fields from the hash value stored at key (binary version).
        Parameters:
        key - the key of the hash
        count - the number of fields to return
        Returns:
        an array of random fields from the hash
      • hrandfieldWithValues

        public java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> hrandfieldWithValues​(java.lang.String key,
                                                                                                                 long count)
        Returns an array of random field-value pairs from the hash value stored at key.
        Parameters:
        key - the key of the hash
        count - the number of field-value pairs to return
        Returns:
        a list of field-value pairs from the hash
      • hrandfieldWithValues

        public java.util.List<java.util.Map.Entry<byte[],​byte[]>> hrandfieldWithValues​(byte[] key,
                                                                                             long count)
        Returns an array of random field-value pairs from the hash value stored at key (binary version).
        Parameters:
        key - the key of the hash
        count - the number of field-value pairs to return
        Returns:
        a list of field-value pairs from the hash
      • hsetex

        public long hsetex​(java.lang.String key,
                           HSetExParams params,
                           java.lang.String field,
                           java.lang.String value)
        Sets the specified field in the hash stored at key to value with expiration and existence conditions. Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        params - the expiration and existence parameters
        field - the field in the hash
        value - the value to set
        Returns:
        1 if field is a new field in the hash and value was set, 0 if field already exists in the hash and the value was updated
      • hsetex

        public long hsetex​(java.lang.String key,
                           HSetExParams params,
                           java.util.Map<java.lang.String,​java.lang.String> hash)
        Sets the specified fields to their respective values in the hash stored at key with expiration and existence conditions. Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        params - the expiration and existence parameters
        hash - a map of field-value pairs to set in the hash
        Returns:
        the number of fields that were added
      • hgetex

        public java.util.List<java.lang.String> hgetex​(java.lang.String key,
                                                       HGetExParams params,
                                                       java.lang.String... fields)
        Retrieves the values associated with the specified fields in a hash stored at the given key and optionally sets their expiration. Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        params - additional parameters for the HGETEX command
        fields - the fields whose values are to be retrieved
        Returns:
        a list of the value associated with each field or nil if the field doesn't exist
      • hgetdel

        public java.util.List<java.lang.String> hgetdel​(java.lang.String key,
                                                        java.lang.String... fields)
        Retrieves the values associated with the specified fields in the hash stored at the given key and then deletes those fields from the hash. Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        fields - the fields whose values are to be retrieved and then deleted
        Returns:
        a list of values associated with the specified fields before they were deleted
      • hsetex

        public long hsetex​(byte[] key,
                           HSetExParams params,
                           byte[] field,
                           byte[] value)
        Sets the specified field in the hash stored at key to value with expiration and existence conditions (binary version). Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        params - the expiration and existence parameters
        field - the field in the hash
        value - the value to set
        Returns:
        1 if field is a new field in the hash and value was set, 0 if field already exists in the hash and the value was updated
      • hsetex

        public long hsetex​(byte[] key,
                           HSetExParams params,
                           java.util.Map<byte[],​byte[]> hash)
        Sets the specified fields to their respective values in the hash stored at key with expiration and existence conditions (binary version). Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        params - the expiration and existence parameters
        hash - a map of field-value pairs to set in the hash
        Returns:
        the number of fields that were added
      • hgetex

        public java.util.List<byte[]> hgetex​(byte[] key,
                                             HGetExParams params,
                                             byte[]... fields)
        Retrieves the values associated with the specified fields in a hash stored at the given key and optionally sets their expiration (binary version). Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        params - additional parameters for the HGETEX command
        fields - the fields whose values are to be retrieved
        Returns:
        a list of the value associated with each field or nil if the field doesn't exist
      • hgetdel

        public java.util.List<byte[]> hgetdel​(byte[] key,
                                              byte[]... fields)
        Retrieves the values associated with the specified fields in the hash stored at the given key and then deletes those fields from the hash (binary version). Note: This command requires Valkey 7.9+ and may not be available in all Valkey versions.
        Parameters:
        key - the key of the hash
        fields - the fields whose values are to be retrieved and then deleted
        Returns:
        a list of values associated with the specified fields before they were deleted
      • hscan

        public ScanResult<java.util.Map.Entry<java.lang.String,​java.lang.String>> hscan​(java.lang.String key,
                                                                                              java.lang.String cursor)
        Iterates fields of Hash types and their associated values.
        Parameters:
        key - the key of the hash
        cursor - the cursor
        Returns:
        scan result with the cursor and the fields
      • hscan

        public ScanResult<java.util.Map.Entry<byte[],​byte[]>> hscan​(byte[] key,
                                                                          byte[] cursor)
        Iterates fields of Hash types and their associated values (binary version).
        Parameters:
        key - the key of the hash
        cursor - the cursor
        Returns:
        scan result with the cursor and the fields
      • hscan

        public ScanResult<java.util.Map.Entry<java.lang.String,​java.lang.String>> hscan​(java.lang.String key,
                                                                                              java.lang.String cursor,
                                                                                              ScanParams params)
        Iterates fields of Hash types and their associated values.
        Parameters:
        key - the key of the hash
        cursor - the cursor
        params - the scan parameters
        Returns:
        scan result with the cursor and the fields
      • hscan

        public ScanResult<java.util.Map.Entry<byte[],​byte[]>> hscan​(byte[] key,
                                                                          byte[] cursor,
                                                                          ScanParams params)
        Iterates fields of Hash types and their associated values (binary version).
        Parameters:
        key - the key of the hash
        cursor - the cursor
        params - the scan parameters
        Returns:
        scan result with the cursor and the fields
      • hscanNoValues

        public ScanResult<java.lang.String> hscanNoValues​(java.lang.String key,
                                                          java.lang.String cursor)
        Iterates fields of Hash types without their values.
        Parameters:
        key - the key of the hash
        cursor - the cursor
        Returns:
        scan result with the cursor and the field names
      • hscanNoValues

        public ScanResult<byte[]> hscanNoValues​(byte[] key,
                                                byte[] cursor)
        Iterates fields of Hash types without their values (binary version).
        Parameters:
        key - the key of the hash
        cursor - the cursor
        Returns:
        scan result with the cursor and the field names
      • hscanNoValues

        public ScanResult<java.lang.String> hscanNoValues​(java.lang.String key,
                                                          java.lang.String cursor,
                                                          ScanParams params)
        Iterates fields of Hash types without their values.
        Parameters:
        key - the key of the hash
        cursor - the cursor
        params - the scan parameters
        Returns:
        scan result with the cursor and the field names
      • hscanNoValues

        public ScanResult<byte[]> hscanNoValues​(byte[] key,
                                                byte[] cursor,
                                                ScanParams params)
        Iterates fields of Hash types without their values (binary version).
        Parameters:
        key - the key of the hash
        cursor - the cursor
        params - the scan parameters
        Returns:
        scan result with the cursor and the field names
      • hexpire

        public java.util.List<java.lang.Long> hexpire​(java.lang.String key,
                                                      long seconds,
                                                      java.lang.String... fields)
        Set expiry for hash field using relative time to expire (seconds). Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        seconds - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpire

        public java.util.List<java.lang.Long> hexpire​(java.lang.String key,
                                                      long seconds,
                                                      ExpiryOption condition,
                                                      java.lang.String... fields)
        Set expiry for hash field using relative time to expire (seconds) with condition. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        seconds - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpire

        public java.util.List<java.lang.Long> hpexpire​(java.lang.String key,
                                                       long milliseconds,
                                                       java.lang.String... fields)
        Set expiry for hash field using relative time to expire (milliseconds). Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        milliseconds - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpire

        public java.util.List<java.lang.Long> hpexpire​(java.lang.String key,
                                                       long milliseconds,
                                                       ExpiryOption condition,
                                                       java.lang.String... fields)
        Set expiry for hash field using relative time to expire (milliseconds) with condition. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        milliseconds - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpireAt

        public java.util.List<java.lang.Long> hexpireAt​(java.lang.String key,
                                                        long unixTimeSeconds,
                                                        java.lang.String... fields)
        Set expiry for hash field using an absolute Unix timestamp (seconds). Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeSeconds - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpireAt

        public java.util.List<java.lang.Long> hexpireAt​(java.lang.String key,
                                                        long unixTimeSeconds,
                                                        ExpiryOption condition,
                                                        java.lang.String... fields)
        Set expiry for hash field using an absolute Unix timestamp (seconds) with condition. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeSeconds - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpireAt

        public java.util.List<java.lang.Long> hpexpireAt​(java.lang.String key,
                                                         long unixTimeMillis,
                                                         java.lang.String... fields)
        Set expiry for hash field using an absolute Unix timestamp (milliseconds). Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeMillis - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpireAt

        public java.util.List<java.lang.Long> hpexpireAt​(java.lang.String key,
                                                         long unixTimeMillis,
                                                         ExpiryOption condition,
                                                         java.lang.String... fields)
        Set expiry for hash field using an absolute Unix timestamp (milliseconds) with condition. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeMillis - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpireTime

        public java.util.List<java.lang.Long> hexpireTime​(java.lang.String key,
                                                          java.lang.String... fields)
        Returns the expiration time of a hash field as a Unix timestamp, in seconds. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get expiration time for
        Returns:
        list of expiration times for each field
      • hpexpireTime

        public java.util.List<java.lang.Long> hpexpireTime​(java.lang.String key,
                                                           java.lang.String... fields)
        Returns the expiration time of a hash field as a Unix timestamp, in milliseconds. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get expiration time for
        Returns:
        list of expiration times for each field
      • httl

        public java.util.List<java.lang.Long> httl​(java.lang.String key,
                                                   java.lang.String... fields)
        Returns the TTL in seconds of a hash field. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get TTL for
        Returns:
        list of TTL values for each field
      • hpttl

        public java.util.List<java.lang.Long> hpttl​(java.lang.String key,
                                                    java.lang.String... fields)
        Returns the TTL in milliseconds of a hash field. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get TTL for
        Returns:
        list of TTL values for each field
      • hpersist

        public java.util.List<java.lang.Long> hpersist​(java.lang.String key,
                                                       java.lang.String... fields)
        Removes the expiration time for each specified field. Note: This command may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to remove expiration for
        Returns:
        list of results for each field
      • hexpire

        public java.util.List<java.lang.Long> hexpire​(byte[] key,
                                                      long seconds,
                                                      byte[]... fields)
        Set expiry for hash field using relative time to expire (seconds) - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        seconds - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpire

        public java.util.List<java.lang.Long> hexpire​(byte[] key,
                                                      long seconds,
                                                      ExpiryOption condition,
                                                      byte[]... fields)
        Set expiry for hash field using relative time to expire (seconds) with condition - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        seconds - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpire

        public java.util.List<java.lang.Long> hpexpire​(byte[] key,
                                                       long milliseconds,
                                                       byte[]... fields)
        Set expiry for hash field using relative time to expire (milliseconds) - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        milliseconds - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpire

        public java.util.List<java.lang.Long> hpexpire​(byte[] key,
                                                       long milliseconds,
                                                       ExpiryOption condition,
                                                       byte[]... fields)
        Set expiry for hash field using relative time to expire (milliseconds) with condition - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        milliseconds - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpireAt

        public java.util.List<java.lang.Long> hexpireAt​(byte[] key,
                                                        long unixTimeSeconds,
                                                        byte[]... fields)
        Set expiry for hash field using an absolute Unix timestamp (seconds) - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeSeconds - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpireAt

        public java.util.List<java.lang.Long> hexpireAt​(byte[] key,
                                                        long unixTimeSeconds,
                                                        ExpiryOption condition,
                                                        byte[]... fields)
        Set expiry for hash field using an absolute Unix timestamp (seconds) with condition - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeSeconds - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpireAt

        public java.util.List<java.lang.Long> hpexpireAt​(byte[] key,
                                                         long unixTimeMillis,
                                                         byte[]... fields)
        Set expiry for hash field using an absolute Unix timestamp (milliseconds) - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeMillis - time to expire
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hpexpireAt

        public java.util.List<java.lang.Long> hpexpireAt​(byte[] key,
                                                         long unixTimeMillis,
                                                         ExpiryOption condition,
                                                         byte[]... fields)
        Set expiry for hash field using an absolute Unix timestamp (milliseconds) with condition - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        unixTimeMillis - time to expire
        condition - expiry condition
        fields - the fields to set expiration for
        Returns:
        list of results for each field
      • hexpireTime

        public java.util.List<java.lang.Long> hexpireTime​(byte[] key,
                                                          byte[]... fields)
        Returns the expiration time of a hash field as a Unix timestamp, in seconds - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get expiration time for
        Returns:
        list of expiration times for each field
      • hpexpireTime

        public java.util.List<java.lang.Long> hpexpireTime​(byte[] key,
                                                           byte[]... fields)
        Returns the expiration time of a hash field as a Unix timestamp, in milliseconds - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get expiration time for
        Returns:
        list of expiration times for each field
      • httl

        public java.util.List<java.lang.Long> httl​(byte[] key,
                                                   byte[]... fields)
        Returns the TTL in seconds of a hash field - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get TTL for
        Returns:
        list of TTL values for each field
      • hpttl

        public java.util.List<java.lang.Long> hpttl​(byte[] key,
                                                    byte[]... fields)
        Returns the TTL in milliseconds of a hash field - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to get TTL for
        Returns:
        list of TTL values for each field
      • hpersist

        public java.util.List<java.lang.Long> hpersist​(byte[] key,
                                                       byte[]... fields)
        Removes the expiration time for each specified field - binary version. Note: This command requires Valkey 7.4+ and may not be available in all Valkey versions.
        Parameters:
        key - hash
        fields - the fields to remove expiration for
        Returns:
        list of results for each field
      • sendBlockingCommand

        public java.lang.Object sendBlockingCommand​(ProtocolCommand cmd,
                                                    java.lang.String... args)
        Send a blocking command to Valkey server. Uses the same implementation as sendCommand since GLIDE handles blocking internally.
      • sendBlockingCommand

        public java.lang.Object sendBlockingCommand​(ProtocolCommand cmd,
                                                    byte[]... args)
        Send a blocking command to Valkey server with byte arrays. Uses the same implementation as sendCommand since GLIDE handles blocking internally.
      • getDB

        public int getDB()
        Get the current database index. NOTE: GLIDE manages database selection internally.
      • lpush

        public long lpush​(java.lang.String key,
                          java.lang.String... strings)
        Inserts all the specified values at the head of the list stored at key.
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • lpush

        public long lpush​(byte[] key,
                          byte[]... strings)
        Inserts all the specified values at the head of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • rpush

        public long rpush​(java.lang.String key,
                          java.lang.String... strings)
        Inserts all the specified values at the tail of the list stored at key.
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • rpush

        public long rpush​(byte[] key,
                          byte[]... strings)
        Inserts all the specified values at the tail of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • lpop

        public java.lang.String lpop​(java.lang.String key)
        Removes and returns the first element of the list stored at key.
        Parameters:
        key - the key of the list
        Returns:
        the value of the first element, or null when key does not exist
      • lpop

        public byte[] lpop​(byte[] key)
        Removes and returns the first element of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        Returns:
        the value of the first element, or null when key does not exist
      • lpop

        public java.util.List<java.lang.String> lpop​(java.lang.String key,
                                                     int count)
        Removes and returns up to count elements from the head of the list stored at key.
        Parameters:
        key - the key of the list
        count - the number of elements to pop
        Returns:
        list of popped elements, or empty list when key does not exist
      • lpop

        public java.util.List<byte[]> lpop​(byte[] key,
                                           int count)
        Removes and returns up to count elements from the head of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        count - the number of elements to pop
        Returns:
        list of popped elements, or empty list when key does not exist
      • rpop

        public java.lang.String rpop​(java.lang.String key)
        Removes and returns the last element of the list stored at key.
        Parameters:
        key - the key of the list
        Returns:
        the value of the last element, or null when key does not exist
      • rpop

        public byte[] rpop​(byte[] key)
        Removes and returns the last element of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        Returns:
        the value of the last element, or null when key does not exist
      • rpop

        public java.util.List<java.lang.String> rpop​(java.lang.String key,
                                                     int count)
        Removes and returns up to count elements from the tail of the list stored at key.
        Parameters:
        key - the key of the list
        count - the number of elements to pop
        Returns:
        list of popped elements, or empty list when key does not exist
      • rpop

        public java.util.List<byte[]> rpop​(byte[] key,
                                           int count)
        Removes and returns up to count elements from the tail of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        count - the number of elements to pop
        Returns:
        list of popped elements, or empty list when key does not exist
      • llen

        public long llen​(java.lang.String key)
        Returns the length of the list stored at key.
        Parameters:
        key - the key of the list
        Returns:
        the length of the list at key
      • llen

        public long llen​(byte[] key)
        Returns the length of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        Returns:
        the length of the list at key
      • lrange

        public java.util.List<java.lang.String> lrange​(java.lang.String key,
                                                       long start,
                                                       long stop)
        Returns the specified elements of the list stored at key.
        Parameters:
        key - the key of the list
        start - the start index
        stop - the stop index
        Returns:
        list of elements in the specified range
      • lrange

        public java.util.List<byte[]> lrange​(byte[] key,
                                             long start,
                                             long stop)
        Returns the specified elements of the list stored at key (binary version).
        Parameters:
        key - the key of the list
        start - the start index
        stop - the stop index
        Returns:
        list of elements in the specified range
      • ltrim

        public java.lang.String ltrim​(java.lang.String key,
                                      long start,
                                      long stop)
        Trim an existing list so that it will contain only the specified range of elements specified.
        Parameters:
        key - the key of the list
        start - the start index
        stop - the stop index
        Returns:
        always "OK"
      • ltrim

        public java.lang.String ltrim​(byte[] key,
                                      long start,
                                      long stop)
        Trim an existing list so that it will contain only the specified range of elements specified (binary version).
        Parameters:
        key - the key of the list
        start - the start index
        stop - the stop index
        Returns:
        always "OK"
      • lindex

        public java.lang.String lindex​(java.lang.String key,
                                       long index)
        Returns the element at index in the list stored at key.
        Parameters:
        key - the key of the list
        index - the index of the element
        Returns:
        the requested element, or null when index is out of range
      • lindex

        public byte[] lindex​(byte[] key,
                             long index)
        Returns the element at index in the list stored at key (binary version).
        Parameters:
        key - the key of the list
        index - the index of the element
        Returns:
        the requested element, or null when index is out of range
      • lset

        public java.lang.String lset​(java.lang.String key,
                                     long index,
                                     java.lang.String element)
        Sets the list element at index to element.
        Parameters:
        key - the key of the list
        index - the index of the element to set
        element - the new element value
        Returns:
        "OK" on success
      • lset

        public java.lang.String lset​(byte[] key,
                                     long index,
                                     byte[] element)
        Sets the list element at index to element (binary version).
        Parameters:
        key - the key of the list
        index - the index of the element to set
        element - the new element value
        Returns:
        "OK" on success
      • lrem

        public long lrem​(java.lang.String key,
                         long count,
                         java.lang.String element)
        Removes the first count occurrences of elements equal to element from the list stored at key.
        Parameters:
        key - the key of the list
        count - the number of elements to remove
        element - the element to remove
        Returns:
        the number of removed elements
      • lrem

        public long lrem​(byte[] key,
                         long count,
                         byte[] element)
        Removes the first count occurrences of elements equal to element from the list stored at key (binary version).
        Parameters:
        key - the key of the list
        count - the number of elements to remove
        element - the element to remove
        Returns:
        the number of removed elements
      • linsert

        public long linsert​(java.lang.String key,
                            ListPosition where,
                            java.lang.String pivot,
                            java.lang.String element)
        Inserts element in the list stored at key either before or after the reference value pivot.
        Parameters:
        key - the key of the list
        where - BEFORE or AFTER
        pivot - the reference value
        element - the element to insert
        Returns:
        the length of the list after the insert operation, or -1 when the value pivot was not found
      • linsert

        public long linsert​(byte[] key,
                            ListPosition where,
                            byte[] pivot,
                            byte[] element)
        Inserts element in the list stored at key either before or after the reference value pivot (binary version).
        Parameters:
        key - the key of the list
        where - BEFORE or AFTER
        pivot - the reference value
        element - the element to insert
        Returns:
        the length of the list after the insert operation, or -1 when the value pivot was not found
      • lpushx

        public long lpushx​(java.lang.String key,
                           java.lang.String... strings)
        Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • lpushx

        public long lpushx​(byte[] key,
                           byte[]... strings)
        Inserts specified values at the head of the list stored at key, only if key already exists and holds a list (binary version).
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • rpushx

        public long rpushx​(java.lang.String key,
                           java.lang.String... strings)
        Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • rpushx

        public long rpushx​(byte[] key,
                           byte[]... strings)
        Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list (binary version).
        Parameters:
        key - the key of the list
        strings - the values to insert
        Returns:
        the length of the list after the push operation
      • blpop

        public java.util.List<java.lang.String> blpop​(int timeout,
                                                      java.lang.String... keys)
        BLPOP is a blocking list pop primitive. It is the blocking version of LPOP.
        Parameters:
        timeout - the timeout in seconds
        keys - the keys to check
        Returns:
        list containing the key and the popped element, or null when no element could be popped
      • blpop

        public KeyValue<java.lang.String,​java.lang.String> blpop​(double timeout,
                                                                       java.lang.String... keys)
        BLPOP is a blocking list pop primitive. It is the blocking version of LPOP.
        Parameters:
        timeout - the timeout in seconds (double precision)
        keys - the keys to check
        Returns:
        KeyValue containing the key and the popped element, or null when no element could be popped
      • blpop

        public java.util.List<byte[]> blpop​(int timeout,
                                            byte[]... keys)
        BLPOP is a blocking list pop primitive. It is the blocking version of LPOP (binary version).
        Parameters:
        timeout - the timeout in seconds
        keys - the keys to check
        Returns:
        list containing the key and the popped element, or null when no element could be popped
      • blpop

        public KeyValue<byte[],​byte[]> blpop​(double timeout,
                                                   byte[]... keys)
        BLPOP is a blocking list pop primitive. It is the blocking version of LPOP (binary version).
        Parameters:
        timeout - the timeout in seconds (double precision)
        keys - the keys to check
        Returns:
        KeyValue containing the key and the popped element, or null when no element could be popped
      • brpop

        public java.util.List<java.lang.String> brpop​(int timeout,
                                                      java.lang.String... keys)
        BRPOP is a blocking list pop primitive. It is the blocking version of RPOP.
        Parameters:
        timeout - the timeout in seconds
        keys - the keys to check
        Returns:
        list containing the key and the popped element, or null when no element could be popped
      • brpop

        public KeyValue<java.lang.String,​java.lang.String> brpop​(double timeout,
                                                                       java.lang.String... keys)
        BRPOP is a blocking list pop primitive. It is the blocking version of RPOP.
        Parameters:
        timeout - the timeout in seconds (double precision)
        keys - the keys to check
        Returns:
        KeyValue containing the key and the popped element, or null when no element could be popped
      • brpop

        public java.util.List<byte[]> brpop​(int timeout,
                                            byte[]... keys)
        BRPOP is a blocking list pop primitive. It is the blocking version of RPOP (binary version).
        Parameters:
        timeout - the timeout in seconds
        keys - the keys to check
        Returns:
        list containing the key and the popped element, or null when no element could be popped
      • brpop

        public KeyValue<byte[],​byte[]> brpop​(double timeout,
                                                   byte[]... keys)
        BRPOP is a blocking list pop primitive. It is the blocking version of RPOP (binary version).
        Parameters:
        timeout - the timeout in seconds (double precision)
        keys - the keys to check
        Returns:
        KeyValue containing the key and the popped element, or null when no element could be popped
      • blpop

        public java.util.List<java.lang.String> blpop​(int timeout,
                                                      java.lang.String key)
        BLPOP is a blocking list pop primitive for a single key.
        Parameters:
        timeout - the timeout in seconds
        key - the key to check
        Returns:
        list containing the key and the popped element, or null when no element could be popped
      • blpop

        public KeyValue<java.lang.String,​java.lang.String> blpop​(double timeout,
                                                                       java.lang.String key)
        BLPOP is a blocking list pop primitive for a single key.
        Parameters:
        timeout - the timeout in seconds (double precision)
        key - the key to check
        Returns:
        KeyValue containing the key and the popped element, or null when no element could be popped
      • brpop

        public java.util.List<java.lang.String> brpop​(int timeout,
                                                      java.lang.String key)
        BRPOP is a blocking list pop primitive for a single key.
        Parameters:
        timeout - the timeout in seconds
        key - the key to check
        Returns:
        list containing the key and the popped element, or null when no element could be popped
      • brpop

        public KeyValue<java.lang.String,​java.lang.String> brpop​(double timeout,
                                                                       java.lang.String key)
        BRPOP is a blocking list pop primitive for a single key.
        Parameters:
        timeout - the timeout in seconds (double precision)
        key - the key to check
        Returns:
        KeyValue containing the key and the popped element, or null when no element could be popped
      • lpos

        public java.lang.Long lpos​(java.lang.String key,
                                   java.lang.String element)
        Returns the index of the first matching element in the list stored at key.
        Parameters:
        key - the key of the list
        element - the element to search for
        Returns:
        the index of the first matching element, or null if not found
      • lpos

        public java.lang.Long lpos​(byte[] key,
                                   byte[] element)
        Returns the index of the first matching element in the list stored at key (binary version).
        Parameters:
        key - the key of the list
        element - the element to search for
        Returns:
        the index of the first matching element, or null if not found
      • lpos

        public java.lang.Long lpos​(java.lang.String key,
                                   java.lang.String element,
                                   LPosParams params)
        Returns the index of matching elements in the list stored at key with additional options.
        Parameters:
        key - the key of the list
        element - the element to search for
        params - additional parameters for the search
        Returns:
        the index of the matching element, or null if not found
      • lpos

        public java.lang.Long lpos​(byte[] key,
                                   byte[] element,
                                   LPosParams params)
        Returns the index of matching elements in the list stored at key with additional options (binary version).
        Parameters:
        key - the key of the list
        element - the element to search for
        params - additional parameters for the search
        Returns:
        the index of the matching element, or null if not found
      • lpos

        public java.util.List<java.lang.Long> lpos​(java.lang.String key,
                                                   java.lang.String element,
                                                   LPosParams params,
                                                   long count)
        Returns the indices of matching elements in the list stored at key.
        Parameters:
        key - the key of the list
        element - the element to search for
        params - additional parameters for the search
        count - the maximum number of matches to return
        Returns:
        list of indices of matching elements
      • lpos

        public java.util.List<java.lang.Long> lpos​(byte[] key,
                                                   byte[] element,
                                                   LPosParams params,
                                                   long count)
        Returns the indices of matching elements in the list stored at key (binary version).
        Parameters:
        key - the key of the list
        element - the element to search for
        params - additional parameters for the search
        count - the maximum number of matches to return
        Returns:
        list of indices of matching elements
      • lmove

        public java.lang.String lmove​(java.lang.String srcKey,
                                      java.lang.String dstKey,
                                      ListDirection from,
                                      ListDirection to)
        Atomically moves an element from one list to another.
        Parameters:
        srcKey - the source list key
        dstKey - the destination list key
        from - the direction to pop from the source list
        to - the direction to push to the destination list
        Returns:
        the element being moved, or null when the source list is empty
      • lmove

        public byte[] lmove​(byte[] srcKey,
                            byte[] dstKey,
                            ListDirection from,
                            ListDirection to)
        Atomically moves an element from one list to another (binary version).
        Parameters:
        srcKey - the source list key
        dstKey - the destination list key
        from - the direction to pop from the source list
        to - the direction to push to the destination list
        Returns:
        the element being moved, or null when the source list is empty
      • blmove

        public java.lang.String blmove​(java.lang.String srcKey,
                                       java.lang.String dstKey,
                                       ListDirection from,
                                       ListDirection to,
                                       double timeout)
        Atomically moves an element from one list to another (binary version).
        Parameters:
        srcKey - the source list key
        dstKey - the destination list key
        from - the direction to pop from the source list
        to - the direction to push to the destination list
        timeout - the timeout in seconds
        Returns:
        the element being moved, or null when timeout is reached
      • blmove

        public byte[] blmove​(byte[] srcKey,
                             byte[] dstKey,
                             ListDirection from,
                             ListDirection to,
                             double timeout)
        Blocking version of LMOVE. Atomically moves an element from one list to another (binary version).
        Parameters:
        srcKey - the source list key
        dstKey - the destination list key
        from - the direction to pop from the source list
        to - the direction to push to the destination list
        timeout - the timeout in seconds
        Returns:
        the element being moved, or null when timeout is reached
      • lmpop

        public KeyValue<java.lang.String,​java.util.List<java.lang.String>> lmpop​(ListDirection direction,
                                                                                       java.lang.String... keys)
        Pops one or more elements from the first non-empty list key from the list of provided key names.
        Parameters:
        direction - the direction to pop from (LEFT or RIGHT)
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when no element could be popped
      • lmpop

        public KeyValue<java.lang.String,​java.util.List<java.lang.String>> lmpop​(ListDirection direction,
                                                                                       int count,
                                                                                       java.lang.String... keys)
        Pops one or more elements from the first non-empty list key from the list of provided key names.
        Parameters:
        direction - the direction to pop from (LEFT or RIGHT)
        count - the maximum number of elements to pop
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when no element could be popped
      • lmpop

        public KeyValue<byte[],​java.util.List<byte[]>> lmpop​(ListDirection direction,
                                                                   byte[]... keys)
        Pops one or more elements from the first non-empty list key from the list of provided key names (binary version).
        Parameters:
        direction - the direction to pop from (LEFT or RIGHT)
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when no element could be popped
      • lmpop

        public KeyValue<byte[],​java.util.List<byte[]>> lmpop​(ListDirection direction,
                                                                   int count,
                                                                   byte[]... keys)
        Pops one or more elements from the first non-empty list key from the list of provided key names (binary version).
        Parameters:
        direction - the direction to pop from (LEFT or RIGHT)
        count - the maximum number of elements to pop
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when no element could be popped
      • blmpop

        public KeyValue<java.lang.String,​java.util.List<java.lang.String>> blmpop​(double timeout,
                                                                                        ListDirection direction,
                                                                                        java.lang.String... keys)
        Blocking version of LMPOP. Pops one or more elements from the first non-empty list key.
        Parameters:
        timeout - the timeout in seconds
        direction - the direction to pop from (LEFT or RIGHT)
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when timeout is reached
      • blmpop

        public KeyValue<java.lang.String,​java.util.List<java.lang.String>> blmpop​(double timeout,
                                                                                        ListDirection direction,
                                                                                        int count,
                                                                                        java.lang.String... keys)
        Blocking version of LMPOP. Pops one or more elements from the first non-empty list key.
        Parameters:
        timeout - the timeout in seconds
        direction - the direction to pop from (LEFT or RIGHT)
        count - the maximum number of elements to pop
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when timeout is reached
      • blmpop

        public KeyValue<byte[],​java.util.List<byte[]>> blmpop​(double timeout,
                                                                    ListDirection direction,
                                                                    byte[]... keys)
        Blocking version of LMPOP. Pops one or more elements from the first non-empty list key (binary version).
        Parameters:
        timeout - the timeout in seconds
        direction - the direction to pop from (LEFT or RIGHT)
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when timeout is reached
      • blmpop

        public KeyValue<byte[],​java.util.List<byte[]>> blmpop​(double timeout,
                                                                    ListDirection direction,
                                                                    int count,
                                                                    byte[]... keys)
        Blocking version of LMPOP. Pops one or more elements from the first non-empty list key (binary version).
        Parameters:
        timeout - the timeout in seconds
        direction - the direction to pop from (LEFT or RIGHT)
        count - the maximum number of elements to pop
        keys - the keys to check
        Returns:
        KeyValue containing the key and list of popped elements, or null when timeout is reached
      • rpoplpush

        @Deprecated
        public java.lang.String rpoplpush​(java.lang.String srckey,
                                          java.lang.String dstkey)
        Deprecated.
        Use LMOVE instead
        Atomically returns and removes the last element of the list stored at source, and pushes the element at the first element of the list stored at destination.
        Parameters:
        srckey - the source key
        dstkey - the destination key
        Returns:
        the element being popped and pushed
      • rpoplpush

        @Deprecated
        public byte[] rpoplpush​(byte[] srckey,
                                byte[] dstkey)
        Deprecated.
        Use LMOVE instead
        Atomically returns and removes the last element of the list stored at source, and pushes the element at the first element of the list stored at destination (binary version).
        Parameters:
        srckey - the source key
        dstkey - the destination key
        Returns:
        the element being popped and pushed
      • brpoplpush

        @Deprecated
        public java.lang.String brpoplpush​(java.lang.String source,
                                           java.lang.String destination,
                                           int timeout)
        Deprecated.
        Use BLMOVE instead
        Blocking version of RPOPLPUSH.
        Parameters:
        source - the source key
        destination - the destination key
        timeout - the timeout in seconds
        Returns:
        the element being popped and pushed, or null when timeout is reached
      • brpoplpush

        @Deprecated
        public byte[] brpoplpush​(byte[] source,
                                 byte[] destination,
                                 int timeout)
        Deprecated.
        Use BLMOVE instead
        Blocking version of RPOPLPUSH (binary version).
        Parameters:
        source - the source key
        destination - the destination key
        timeout - the timeout in seconds
        Returns:
        the element being popped and pushed, or null when timeout is reached