Interface HashBaseCommands

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FIELDS_VALKEY_API
      Valkey API keyword used to specify fields in hash commands.
      static java.lang.String WITH_VALUES_VALKEY_API
      Valkey API keyword used to query hash members with their values.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Long> hdel​(GlideString key, GlideString[] fields)
      Removes the specified fields from the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> hdel​(java.lang.String key, java.lang.String[] fields)
      Removes the specified fields from the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> hexists​(GlideString key, GlideString field)
      Returns if field is an existing field in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.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.concurrent.CompletableFuture<java.lang.Long[]> hexpire​(GlideString key, long seconds, GlideString[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpire​(java.lang.String key, long seconds, java.lang.String[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpireat​(GlideString key, long unixSeconds, GlideString[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields, in seconds, using an absolute Unix timestamp.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpireat​(java.lang.String key, long unixSeconds, java.lang.String[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields, in seconds, using an absolute Unix timestamp.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpiretime​(GlideString key, GlideString[] fields)
      Returns the absolute Unix timestamp (in seconds) at which the given hash fields will expire.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpiretime​(java.lang.String key, java.lang.String[] fields)
      Returns the absolute Unix timestamp (in seconds) at which the given hash fields will expire.
      java.util.concurrent.CompletableFuture<GlideString> hget​(GlideString key, GlideString field)
      Retrieves the value associated with field in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String> hget​(java.lang.String key, java.lang.String field)
      Retrieves the value associated with field in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.util.Map<GlideString,​GlideString>> hgetall​(GlideString key)
      Returns all fields and values of the hash stored at key.
      java.util.concurrent.CompletableFuture<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.concurrent.CompletableFuture<GlideString[]> hgetex​(GlideString key, GlideString[] fields, HGetExOptions options)
      Retrieves the values of specified fields from the hash stored at key and optionally sets their expiration or removes it.
      java.util.concurrent.CompletableFuture<java.lang.String[]> hgetex​(java.lang.String key, java.lang.String[] fields, HGetExOptions options)
      Retrieves the values of specified fields from the hash stored at key and optionally sets their expiration or removes it.
      java.util.concurrent.CompletableFuture<java.lang.Long> hincrBy​(GlideString key, GlideString field, long amount)
      Increments the number stored at field in the hash stored at key by increment.
      java.util.concurrent.CompletableFuture<java.lang.Long> hincrBy​(java.lang.String key, java.lang.String field, long amount)
      Increments the number stored at field in the hash stored at key by increment.
      java.util.concurrent.CompletableFuture<java.lang.Double> hincrByFloat​(GlideString key, GlideString field, double amount)
      Increments the string representing a floating point number stored at field in the hash stored at key by increment.
      java.util.concurrent.CompletableFuture<java.lang.Double> hincrByFloat​(java.lang.String key, java.lang.String field, double amount)
      Increments the string representing a floating point number stored at field in the hash stored at key by increment.
      java.util.concurrent.CompletableFuture<GlideString[]> hkeys​(GlideString key)
      Returns all field names in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String[]> hkeys​(java.lang.String key)
      Returns all field names in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> hlen​(GlideString key)
      Returns the number of fields contained in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> hlen​(java.lang.String key)
      Returns the number of fields contained in the hash stored at key.
      java.util.concurrent.CompletableFuture<GlideString[]> hmget​(GlideString key, GlideString[] fields)
      Returns the values associated with the specified fields in the hash stored at key.
      java.util.concurrent.CompletableFuture<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.util.concurrent.CompletableFuture<java.lang.Long[]> hpersist​(GlideString key, GlideString[] fields)
      Removes the expiration time for each specified field, turning the field from volatile (a field with expiration time) to persistent (a field that will never expire as no expiration time is associated).
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpersist​(java.lang.String key, java.lang.String[] fields)
      Removes the expiration time for each specified field, turning the field from volatile (a field with expiration time) to persistent (a field that will never expire as no expiration time is associated).
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpire​(GlideString key, long milliseconds, GlideString[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpire​(java.lang.String key, long milliseconds, java.lang.String[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpireat​(GlideString key, long unixMilliseconds, GlideString[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields, using an absolute Unix timestamp in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpireat​(java.lang.String key, long unixMilliseconds, java.lang.String[] fields, HashFieldExpirationConditionOptions options)
      Sets expiration time for hash fields, using an absolute Unix timestamp in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpiretime​(GlideString key, GlideString[] fields)
      Returns the absolute Unix timestamp (in milliseconds) at which the given hash fields will expire.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpiretime​(java.lang.String key, java.lang.String[] fields)
      Returns the absolute Unix timestamp (in milliseconds) at which the given hash fields will expire.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpttl​(GlideString key, GlideString[] fields)
      Returns the remaining time to live of hash fields that have a timeout, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> hpttl​(java.lang.String key, java.lang.String[] fields)
      Returns the remaining time to live of hash fields that have a timeout, in milliseconds.
      java.util.concurrent.CompletableFuture<GlideString> hrandfield​(GlideString key)
      Returns a random field name from the hash value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String> hrandfield​(java.lang.String key)
      Returns a random field name from the hash value stored at key.
      java.util.concurrent.CompletableFuture<GlideString[]> hrandfieldWithCount​(GlideString key, long count)
      Retrieves up to count random field names from the hash value stored at key .
      java.util.concurrent.CompletableFuture<java.lang.String[]> hrandfieldWithCount​(java.lang.String key, long count)
      Retrieves up to count random field names from the hash value stored at key .
      java.util.concurrent.CompletableFuture<GlideString[][]> hrandfieldWithCountWithValues​(GlideString key, long count)
      Retrieves up to count random field names along with their values from the hash value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String[][]> hrandfieldWithCountWithValues​(java.lang.String key, long count)
      Retrieves up to count random field names along with their values from the hash value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(GlideString key, GlideString cursor)
      Iterates fields of Hash types and their associated values.
      java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(GlideString key, GlideString cursor, HScanOptionsBinary hScanOptions)
      Iterates fields of Hash types and their associated values.
      java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(java.lang.String key, java.lang.String cursor)
      Iterates fields of Hash types and their associated values.
      java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(java.lang.String key, java.lang.String cursor, HScanOptions hScanOptions)
      Iterates fields of Hash types and their associated values.
      java.util.concurrent.CompletableFuture<java.lang.Long> hset​(GlideString key, java.util.Map<GlideString,​GlideString> fieldValueMap)
      Sets the specified fields to their respective values in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> hset​(java.lang.String key, java.util.Map<java.lang.String,​java.lang.String> fieldValueMap)
      Sets the specified fields to their respective values in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> hsetex​(GlideString key, java.util.Map<GlideString,​GlideString> fieldValueMap, HSetExOptions options)
      Sets the specified fields to their respective values in the hash stored at key with optional expiration and conditional options.
      java.util.concurrent.CompletableFuture<java.lang.Long> hsetex​(java.lang.String key, java.util.Map<java.lang.String,​java.lang.String> fieldValueMap, HSetExOptions options)
      Sets the specified fields to their respective values in the hash stored at key with optional expiration and conditional options.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> hsetnx​(GlideString key, GlideString field, GlideString value)
      Sets field in the hash stored at key to value, only if field does not yet exist.
      If key does not exist, a new key holding a hash is created.
      If field already exists, this operation has no effect.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> 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.
      If key does not exist, a new key holding a hash is created.
      If field already exists, this operation has no effect.
      java.util.concurrent.CompletableFuture<java.lang.Long> hstrlen​(GlideString key, GlideString field)
      Returns the string length of the value associated with field in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.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.concurrent.CompletableFuture<java.lang.Long[]> httl​(GlideString key, GlideString[] fields)
      Returns the remaining time to live of hash fields that have a timeout, in seconds.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> httl​(java.lang.String key, java.lang.String[] fields)
      Returns the remaining time to live of hash fields that have a timeout, in seconds.
      java.util.concurrent.CompletableFuture<GlideString[]> hvals​(GlideString key)
      Returns all values in the hash stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String[]> hvals​(java.lang.String key)
      Returns all values in the hash stored at key.
    • Field Detail

      • WITH_VALUES_VALKEY_API

        static final java.lang.String WITH_VALUES_VALKEY_API
        Valkey API keyword used to query hash members with their values.
        See Also:
        Constant Field Values
      • FIELDS_VALKEY_API

        static final java.lang.String FIELDS_VALKEY_API
        Valkey API keyword used to specify fields in hash commands.
        See Also:
        Constant Field Values
    • Method Detail

      • hget

        java.util.concurrent.CompletableFuture<java.lang.String> hget​(java.lang.String key,
                                                                      java.lang.String field)
        Retrieves the value associated with field in the hash stored at key.
        Parameters:
        key - The key of the hash.
        field - The field in the hash stored at key to retrieve from the database.
        Returns:
        The value associated with field, or null when field is not present in the hash or key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         String payload = client.hget("my_hash", "field1").get();
         assert payload.equals("value");
        
         String payload = client.hget("my_hash", "nonexistent_field").get();
         assert payload.equals(null);
         
      • hget

        java.util.concurrent.CompletableFuture<GlideString> hget​(GlideString key,
                                                                 GlideString field)
        Retrieves the value associated with field in the hash stored at key.
        Parameters:
        key - The key of the hash.
        field - The field in the hash stored at key to retrieve from the database.
        Returns:
        The value associated with field, or null when field is not present in the hash or key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         String payload = client.hget(gs("my_hash"), gs("field1")).get();
         assert payload.equals(gs("value"));
        
         String payload = client.hget(gs("my_hash"), gs("nonexistent_field")).get();
         assert payload.equals(null);
         
      • hset

        java.util.concurrent.CompletableFuture<java.lang.Long> hset​(java.lang.String key,
                                                                    java.util.Map<java.lang.String,​java.lang.String> fieldValueMap)
        Sets the specified fields to their respective values in the hash stored at key.
        Parameters:
        key - The key of the hash.
        fieldValueMap - A field-value map consisting of fields and their corresponding values to be set in the hash stored at the specified key.
        Returns:
        The number of fields that were added.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.hset("my_hash", Map.of("field", "value", "field2", "value2")).get();
         assert num == 2L;
         
      • hset

        java.util.concurrent.CompletableFuture<java.lang.Long> hset​(GlideString key,
                                                                    java.util.Map<GlideString,​GlideString> fieldValueMap)
        Sets the specified fields to their respective values in the hash stored at key.
        Parameters:
        key - The key of the hash.
        fieldValueMap - A field-value map consisting of fields and their corresponding values to be set in the hash stored at the specified key.
        Returns:
        The number of fields that were added.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.hset(gs("my_hash"), Map.of(gs("field"), gs("value"), gs("field2"), gs("value2"))).get();
         assert num == 2L;
         
      • hsetnx

        java.util.concurrent.CompletableFuture<java.lang.Boolean> 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.
        If key does not exist, a new key holding a hash is created.
        If field already exists, this operation has no effect.
        Parameters:
        key - The key of the hash.
        field - The field to set the value for.
        value - The value to set.
        Returns:
        true if the field was set, false if the field already existed and was not set.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean payload1 = client.hsetnx("myHash", "field", "value").get();
         assert payload1; // Indicates that the field "field" was set successfully in the hash "myHash".
        
         Boolean payload2 = client.hsetnx("myHash", "field", "newValue").get();
         assert !payload2; // Indicates that the field "field" already existed in the hash "myHash" and was not set again.
         
      • hsetnx

        java.util.concurrent.CompletableFuture<java.lang.Boolean> hsetnx​(GlideString key,
                                                                         GlideString field,
                                                                         GlideString value)
        Sets field in the hash stored at key to value, only if field does not yet exist.
        If key does not exist, a new key holding a hash is created.
        If field already exists, this operation has no effect.
        Parameters:
        key - The key of the hash.
        field - The field to set the value for.
        value - The value to set.
        Returns:
        true if the field was set, false if the field already existed and was not set.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean payload1 = client.hsetnx(gs("myHash"), gs("field"), gs("value")).get();
         assert payload1; // Indicates that the field "field" was set successfully in the hash "myHash".
        
         Boolean payload2 = client.hsetnx(gs("myHash"), gs("field"), gs("newValue")).get();
         assert !payload2; // Indicates that the field "field" already existed in the hash "myHash" and was not set again.
         
      • hdel

        java.util.concurrent.CompletableFuture<java.lang.Long> hdel​(java.lang.String key,
                                                                    java.lang.String[] fields)
        Removes the specified fields from the hash stored at key. Specified fields that do not exist within this hash are ignored.
        Parameters:
        key - The key of the hash.
        fields - The fields to remove from the hash stored at key.
        Returns:
        The number of fields that were removed from the hash, not including specified but non-existing fields.
        If key does not exist, it is treated as an empty hash and it returns 0.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.hdel("my_hash", new String[] {"field1", "field2"}).get();
         assert num == 2L; //Indicates that two fields were successfully removed from the hash.
         
      • hdel

        java.util.concurrent.CompletableFuture<java.lang.Long> hdel​(GlideString key,
                                                                    GlideString[] fields)
        Removes the specified fields from the hash stored at key. Specified fields that do not exist within this hash are ignored.
        Parameters:
        key - The key of the hash.
        fields - The fields to remove from the hash stored at key.
        Returns:
        The number of fields that were removed from the hash, not including specified but non-existing fields.
        If key does not exist, it is treated as an empty hash and it returns 0.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.hdel("my_hash", new String[] {gs("field1"), gs("field2")}).get();
         assert num == 2L; //Indicates that two fields were successfully removed from the hash.
         
      • hlen

        java.util.concurrent.CompletableFuture<java.lang.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 the key does not exist.
        If key holds a value that is not a hash, an error is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long num1 = client.hlen("myHash").get();
         assert num1 == 3L;
        
         Long num2 = client.hlen("nonExistingKey").get();
         assert num2 == 0L;
         
      • hlen

        java.util.concurrent.CompletableFuture<java.lang.Long> hlen​(GlideString 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 the key does not exist.
        If key holds a value that is not a hash, an error is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long num1 = client.hlen(gs("myHash")).get();
         assert num1 == 3L;
        
         Long num2 = client.hlen(gs("nonExistingKey")).get();
         assert num2 == 0L;
         
      • hvals

        java.util.concurrent.CompletableFuture<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:
        An array of values in the hash, or an empty array when the key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         String[] values = client.hvals("myHash").get();
         assert Arrays.equals(values, new String[] {"value1", "value2", "value3"}); // Returns all the values stored in the hash "myHash".
         
      • hvals

        java.util.concurrent.CompletableFuture<GlideString[]> hvals​(GlideString key)
        Returns all values in the hash stored at key.
        Parameters:
        key - The key of the hash.
        Returns:
        An array of values in the hash, or an empty array when the key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         GlideString[] values = client.hvals(gs("myHash")).get();
         assert Arrays.equals(values, new GlideString[] {gs("value1"), gs("value2"), gs("value3")}); // Returns all the values stored in the hash "myHash".
         
      • hmget

        java.util.concurrent.CompletableFuture<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 stored at key to retrieve from the database.
        Returns:
        An array of values associated with the given fields, in the same order as they are requested.
        For every field that does not exist in the hash, a null value is returned.
        If key does not exist, it is treated as an empty hash, and it returns an array of null values.
        See Also:
        valkey.io for details.
        Example:
        
         String[] values = client.hmget("my_hash", new String[] {"field1", "field2"}).get()
         assert Arrays.equals(values, new String[] {"value1", "value2"});
         
      • hmget

        java.util.concurrent.CompletableFuture<GlideString[]> hmget​(GlideString key,
                                                                    GlideString[] 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 stored at key to retrieve from the database.
        Returns:
        An array of values associated with the given fields, in the same order as they are requested.
        For every field that does not exist in the hash, a null value is returned.
        If key does not exist, it is treated as an empty hash, and it returns an array of null values.
        See Also:
        valkey.io for details.
        Example:
        
         GlideString[] values = client.hmget(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2")}).get()
         assert Arrays.equals(values, new GlideString[] {gs("value1"), gs("value2")});
         
      • hexists

        java.util.concurrent.CompletableFuture<java.lang.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 to check in the hash stored at key.
        Returns:
        True if the hash contains the specified field. If the hash does not contain the field, or if the key does not exist, it returns False.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean exists = client.hexists("my_hash", "field1").get();
         assert exists;
        
         Boolean exists = client.hexists("my_hash", "non_existent_field").get();
         assert !exists;
         
      • hexists

        java.util.concurrent.CompletableFuture<java.lang.Boolean> hexists​(GlideString key,
                                                                          GlideString field)
        Returns if field is an existing field in the hash stored at key.
        Parameters:
        key - The key of the hash.
        field - The field to check in the hash stored at key.
        Returns:
        True if the hash contains the specified field. If the hash does not contain the field, or if the key does not exist, it returns False.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean exists = client.hexists(gs("my_hash"), gs("field1")).get();
         assert exists;
        
         Boolean exists = client.hexists(gs("my_hash"), gs("non_existent_field")).get();
         assert !exists;
         
      • hgetall

        java.util.concurrent.CompletableFuture<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. Every field name in the map is associated with its corresponding value.
        If key does not exist, it returns an empty map.
        See Also:
        valkey.io for details.
        Example:
        
         Map fieldValueMap = client.hgetall("my_hash").get();
         assert fieldValueMap.equals(Map.of(field1", "value1", "field2", "value2"));
         
      • hgetall

        java.util.concurrent.CompletableFuture<java.util.Map<GlideString,​GlideString>> hgetall​(GlideString 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. Every field name in the map is associated with its corresponding value.
        If key does not exist, it returns an empty map.
        See Also:
        valkey.io for details.
        Example:
        
         Map fieldValueMap = client.hgetall(gs("my_hash")).get();
         assert fieldValueMap.equals(Map.of(gs("field1"), gs("value1"), gs("field2"), gs("value2")));
         
      • hincrBy

        java.util.concurrent.CompletableFuture<java.lang.Long> hincrBy​(java.lang.String key,
                                                                       java.lang.String field,
                                                                       long amount)
        Increments the number stored at field in the hash stored at key by increment. By using a negative increment value, the value stored at field in the hash stored at key is decremented. If field or key does not exist, it is set to 0 before performing the operation.
        Parameters:
        key - The key of the hash.
        field - The field in the hash stored at key to increment or decrement its value.
        amount - The amount by which to increment or decrement the field's value. Use a negative value to decrement.
        Returns:
        The value of field in the hash stored at key after the increment or decrement.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.hincrBy("my_hash", "field1", 5).get();
         assert num == 5L;
         
      • hincrBy

        java.util.concurrent.CompletableFuture<java.lang.Long> hincrBy​(GlideString key,
                                                                       GlideString field,
                                                                       long amount)
        Increments the number stored at field in the hash stored at key by increment. By using a negative increment value, the value stored at field in the hash stored at key is decremented. If field or key does not exist, it is set to 0 before performing the operation.
        Parameters:
        key - The key of the hash.
        field - The field in the hash stored at key to increment or decrement its value.
        amount - The amount by which to increment or decrement the field's value. Use a negative value to decrement.
        Returns:
        The value of field in the hash stored at key after the increment or decrement.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.hincrBy(gs("my_hash"), gs("field1"), 5).get();
         assert num == 5L;
         
      • hincrByFloat

        java.util.concurrent.CompletableFuture<java.lang.Double> hincrByFloat​(java.lang.String key,
                                                                              java.lang.String field,
                                                                              double amount)
        Increments the string representing a floating point number stored at field in the hash stored at key by increment. By using a negative increment value, the value stored at field in the hash stored at key is decremented. If field or key does not exist, it is set to 0 before performing the operation.
        Parameters:
        key - The key of the hash.
        field - The field in the hash stored at key to increment or decrement its value.
        amount - The amount by which to increment or decrement the field's value. Use a negative value to decrement.
        Returns:
        The value of field in the hash stored at key after the increment or decrement.
        See Also:
        valkey.io for details.
        Example:
        
         Double num = client.hincrByFloat("my_hash", "field1", 2.5).get();
         assert num == 2.5;
         
      • hincrByFloat

        java.util.concurrent.CompletableFuture<java.lang.Double> hincrByFloat​(GlideString key,
                                                                              GlideString field,
                                                                              double amount)
        Increments the string representing a floating point number stored at field in the hash stored at key by increment. By using a negative increment value, the value stored at field in the hash stored at key is decremented. If field or key does not exist, it is set to 0 before performing the operation.
        Parameters:
        key - The key of the hash.
        field - The field in the hash stored at key to increment or decrement its value.
        amount - The amount by which to increment or decrement the field's value. Use a negative value to decrement.
        Returns:
        The value of field in the hash stored at key after the increment or decrement.
        See Also:
        valkey.io for details.
        Example:
        
         Double num = client.hincrByFloat(gs("my_hash"), gs("field1"), 2.5).get();
         assert num == 2.5;
         
      • hkeys

        java.util.concurrent.CompletableFuture<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:
        An array of field names in the hash, or an empty array when the key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         String[] names = client.hkeys("my_hash").get();
         assert Arrays.equals(names, new String[] { "field_1", "field_2" });
         
      • hkeys

        java.util.concurrent.CompletableFuture<GlideString[]> hkeys​(GlideString key)
        Returns all field names in the hash stored at key.
        Parameters:
        key - The key of the hash.
        Returns:
        An array of field names in the hash, or an empty array when the key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         GlideString[] names = client.hkeys(gs("my_hash")).get();
         assert Arrays.equals(names, new GlideString[] { gs("field_1"), gs("field_2") });
         
      • hstrlen

        java.util.concurrent.CompletableFuture<java.lang.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 or 0 if field or key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         Long strlen = client.hstrlen("my_hash", "my_field").get();
         assert strlen >= 0L;
         
      • hstrlen

        java.util.concurrent.CompletableFuture<java.lang.Long> hstrlen​(GlideString key,
                                                                       GlideString 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 or 0 if field or key does not exist.
        See Also:
        valkey.io for details.
        Example:
        
         Long strlen = client.hstrlen(gs("my_hash"), gs("my_field")).get();
         assert strlen >= 0L;
         
      • hrandfield

        java.util.concurrent.CompletableFuture<java.lang.String> hrandfield​(java.lang.String key)
        Returns a random field name from the hash value stored at key.
        Parameters:
        key - The key of the hash.
        Returns:
        A random field name from the hash stored at key, or null when the key does not exist.
        Since:
        Valkey 6.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         String field = client.hrandfield("my_hash").get();
         System.out.printf("A random field from the hash is '%s'", field);
         
      • hrandfield

        java.util.concurrent.CompletableFuture<GlideString> hrandfield​(GlideString key)
        Returns a random field name from the hash value stored at key.
        Parameters:
        key - The key of the hash.
        Returns:
        A random field name from the hash stored at key, or null when the key does not exist.
        Since:
        Valkey 6.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         GlideString field = client.hrandfield(gs("my_hash")).get();
         System.out.printf("A random field from the hash is '%s'", field);
         
      • hrandfieldWithCount

        java.util.concurrent.CompletableFuture<java.lang.String[]> hrandfieldWithCount​(java.lang.String key,
                                                                                       long count)
        Retrieves up to count random field names from the hash value stored at key .
        Parameters:
        key - The key of the hash.
        count - The number of field names to return.
        If count is positive, returns unique elements.
        If negative, allows for duplicates.
        Returns:
        An array of random field names from the hash stored at key, or an empty array when the key does not exist.
        Since:
        Valkey 6.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         String[] fields = client.hrandfieldWithCount("my_hash", 10).get();
         System.out.printf("Random fields from the hash are '%s'", String.join(", ", fields));
         
      • hrandfieldWithCount

        java.util.concurrent.CompletableFuture<GlideString[]> hrandfieldWithCount​(GlideString key,
                                                                                  long count)
        Retrieves up to count random field names from the hash value stored at key .
        Parameters:
        key - The key of the hash.
        count - The number of field names to return.
        If count is positive, returns unique elements.
        If negative, allows for duplicates.
        Returns:
        An array of random field names from the hash stored at key, or an empty array when the key does not exist.
        Since:
        Valkey 6.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         GlideString[] fields = client.hrandfieldWithCount(gs("my_hash"), 10).get();
         System.out.printf("Random fields from the hash are '%s'", GlideString.join(", ", fields));
         
      • hrandfieldWithCountWithValues

        java.util.concurrent.CompletableFuture<java.lang.String[][]> hrandfieldWithCountWithValues​(java.lang.String key,
                                                                                                   long count)
        Retrieves up to count random field names along with their values from the hash value stored at key.
        Parameters:
        key - The key of the hash.
        count - The number of field names to return.
        If count is positive, returns unique elements.
        If negative, allows for duplicates.
        Returns:
        A 2D array of [fieldName, value] arrays, where fieldName is a random field name from the hash and value is the associated value of the field name.
        If the hash does not exist or is empty, the response will be an empty array.
        Since:
        Valkey 6.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         String[][] fields = client.hrandfieldWithCountWithValues("my_hash", 1).get();
         System.out.printf("A random field from the hash is '%s' and the value is '%s'", fields[0][0], fields[0][1]);
         
      • hrandfieldWithCountWithValues

        java.util.concurrent.CompletableFuture<GlideString[][]> hrandfieldWithCountWithValues​(GlideString key,
                                                                                              long count)
        Retrieves up to count random field names along with their values from the hash value stored at key.
        Parameters:
        key - The key of the hash.
        count - The number of field names to return.
        If count is positive, returns unique elements.
        If negative, allows for duplicates.
        Returns:
        A 2D array of [fieldName, value] arrays, where fieldName is a random field name from the hash and value is the associated value of the field name.
        If the hash does not exist or is empty, the response will be an empty array.
        Since:
        Valkey 6.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         GlideString[][] fields = client.hrandfieldWithCountWithValues(gs("my_hash"), 1).get();
         System.out.printf("A random field from the hash is '%s' and the value is '%s'", fields[0][0], fields[0][1]);
         
      • hscan

        java.util.concurrent.CompletableFuture<java.lang.Object[]> 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 that points to the next iteration of results. A value of "0" indicates the start of the search.
        Returns:
        An Array of Objects. The first element is always the cursor for the next iteration of results. "0" will be the cursor returned on the last iteration of the result. The second element is always an Array of the subset of the hash held in key. The array in the second element is always a flattened series of String pairs, where the key is at even indices and the value is at odd indices.
        See Also:
        valkey.io for details.
        Example:
        
         // Assume key contains a set with 200 member-score pairs
         String cursor = "0";
         Object[] result;
         do {
           result = client.hscan(key1, cursor).get();
           cursor = result[0].toString();
           Object[] stringResults = (Object[]) result[1];
        
           System.out.println("\nHSCAN iteration:");
           for (int i = 0; i < stringResults.length; i += 2) {
             System.out.printf("{%s=%s}", stringResults[i], stringResults[i + 1]);
             if (i + 2 < stringResults.length) {
               System.out.print(", ");
             }
           }
         } while (!cursor.equals("0"));
         
      • hscan

        java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(GlideString key,
                                                                         GlideString cursor)
        Iterates fields of Hash types and their associated values.
        Parameters:
        key - The key of the hash.
        cursor - The cursor that points to the next iteration of results. A value of "0" indicates the start of the search.
        Returns:
        An Array of Objects. The first element is always the cursor for the next iteration of results. "0" will be the cursor returned on the last iteration of the result. The second element is always an Array of the subset of the hash held in key. The array in the second element is always a flattened series of String pairs, where the key is at even indices and the value is at odd indices.
        See Also:
        valkey.io for details.
        Example:
        
         // Assume key contains a set with 200 member-score pairs
         GlideString cursor = gs("0");
         Object[] result;
         do {
           result = client.hscan(key1, cursor).get();
           cursor = gs(result[0].toString());
           Object[] glideStringResults = (Object[]) result[1];
        
           System.out.println("\nHSCAN iteration:");
           for (int i = 0; i < glideStringResults.length; i += 2) {
             System.out.printf("{%s=%s}", glideStringResults[i], glideStringResults[i + 1]);
             if (i + 2 < glideStringResults.length) {
               System.out.print(", ");
             }
           }
         } while (!cursor.equals(gs("0")));
         
      • hscan

        java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(java.lang.String key,
                                                                         java.lang.String cursor,
                                                                         HScanOptions hScanOptions)
        Iterates fields of Hash types and their associated values.
        Parameters:
        key - The key of the hash.
        cursor - The cursor that points to the next iteration of results. A value of "0" indicates the start of the search.
        hScanOptions - The HScanOptions.
        Returns:
        An Array of Objects. The first element is always the cursor for the next iteration of results. "0" will be the cursor returned on the last iteration of the result. The second element is always an Array of the subset of the hash held in key. The array in the second element is a flattened series of String pairs, where the key is at even indices and the value is at odd indices. If HScanOptions.HScanOptionsBuilder.noValues(boolean) is set to true , the second element will only contain the fields without the values.
        See Also:
        valkey.io for details.
        Example:
        
         // Assume key contains a set with 200 member-score pairs
         String cursor = "0";
         Object[] result;
         do {
           result = client.hscan(key1, cursor, HScanOptions.builder().matchPattern("*").count(20L).build()).get();
           cursor = result[0].toString();
           Object[] stringResults = (Object[]) result[1];
        
           System.out.println("\nHSCAN iteration:");
           for (int i = 0; i < stringResults.length; i += 2) {
             System.out.printf("{%s=%s}", stringResults[i], stringResults[i + 1]);
             if (i + 2 < stringResults.length) {
               System.out.print(", ");
             }
           }
         } while (!cursor.equals("0"));
         
      • hscan

        java.util.concurrent.CompletableFuture<java.lang.Object[]> hscan​(GlideString key,
                                                                         GlideString cursor,
                                                                         HScanOptionsBinary hScanOptions)
        Iterates fields of Hash types and their associated values.
        Parameters:
        key - The key of the hash.
        cursor - The cursor that points to the next iteration of results. A value of "0" indicates the start of the search.
        hScanOptions - The HScanOptionsBinary.
        Returns:
        An Array of Objects. The first element is always the cursor for the next iteration of results. "0" will be the cursor returned on the last iteration of the result. The second element is always an Array of the subset of the hash held in key. The array in the second element is a flattened series of String pairs, where the key is at even indices and the value is at odd indices. If HScanOptionsBinary.HScanOptionsBinaryBuilder.noValues(boolean) is set to true , the second element will only contain the fields without the values.
        See Also:
        valkey.io for details.
        Example:
        
         // Assume key contains a set with 200 member-score pairs
         GlideString cursor = gs("0");
         Object[] result;
         do {
           result = client.hscan(key1, cursor, HScanOptionsBinary.builder().matchPattern(gs("*")).count(20L).build()).get();
           cursor = gs(result[0].toString());
           Object[] gslideStringResults = (Object[]) result[1];
        
           System.out.println("\nHSCAN iteration:");
           for (int i = 0; i < gslideStringResults.length; i += 2) {
             System.out.printf("{%s=%s}", gslideStringResults[i], gslideStringResults[i + 1]);
             if (i + 2 < gslideStringResults.length) {
               System.out.print(", ");
             }
           }
         } while (!cursor.equals(gs("0")));
         
      • hsetex

        java.util.concurrent.CompletableFuture<java.lang.Long> hsetex​(java.lang.String key,
                                                                      java.util.Map<java.lang.String,​java.lang.String> fieldValueMap,
                                                                      HSetExOptions options)
        Sets the specified fields to their respective values in the hash stored at key with optional expiration and conditional options.
        Parameters:
        key - The key of the hash.
        fieldValueMap - A field-value map consisting of fields and their corresponding values to be set in the hash stored at the specified key.
        options - Optional parameters for the command including conditional changes and expiry settings. See HSetExOptions.
        Returns:
        1 if all the fields' values and expiration times were set successfully, 0 otherwise.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set fields with 60 second expiration
         HSetExOptions options = HSetExOptions.builder()
             .expiry(ExpirySet.Seconds(60L))
             .build();
         Long num = client.hsetex("my_hash", Map.of("field1", "value1", "field2", "value2"), options).get();
         assert num == 1L;
        
         // Set fields only if none exist, with 30 second expiration
         HSetExOptions conditionalOptions = HSetExOptions.builder()
             .onlyIfNoneExist()
             .expiry(ExpirySet.Milliseconds(30000L))
             .build();
         Long result = client.hsetex("new_hash", Map.of("field", "value"), conditionalOptions).get();
         assert result == 1L;
        
         // Set fields only if all exist, keeping existing expiration
         HSetExOptions updateOptions = HSetExOptions.builder()
             .onlyIfAllExist()
             .expiry(ExpirySet.KeepExisting())
             .build();
         Long updateResult = client.hsetex("existing_hash", Map.of("field1", "newValue"), updateOptions).get();
         
      • hsetex

        java.util.concurrent.CompletableFuture<java.lang.Long> hsetex​(GlideString key,
                                                                      java.util.Map<GlideString,​GlideString> fieldValueMap,
                                                                      HSetExOptions options)
        Sets the specified fields to their respective values in the hash stored at key with optional expiration and conditional options.
        Parameters:
        key - The key of the hash.
        fieldValueMap - A field-value map consisting of fields and their corresponding values to be set in the hash stored at the specified key.
        options - Optional parameters for the command including conditional changes and expiry settings. See HSetExOptions.
        Returns:
        1 if all the fields' values and expiration times were set successfully, 0 otherwise.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set fields with 60 second expiration
         HSetExOptions options = HSetExOptions.builder()
             .expiry(ExpirySet.Seconds(60L))
             .build();
         Long num = client.hsetex(gs("my_hash"), Map.of(gs("field1"), gs("value1"), gs("field2"), gs("value2")), options).get();
         assert num == 1L;
        
         // Set fields only if none exist, with 30 second expiration
         HSetExOptions conditionalOptions = HSetExOptions.builder()
             .onlyIfNoneExist()
             .expiry(ExpirySet.Milliseconds(30000L))
             .build();
         Long result = client.hsetex(gs("new_hash"), Map.of(gs("field"), gs("value")), conditionalOptions).get();
         assert result == 1L;
        
         // Set fields only if all exist, keeping existing expiration
         HSetExOptions updateOptions = HSetExOptions.builder()
             .onlyIfAllExist()
             .expiry(ExpirySet.KeepExisting())
             .build();
         Long updateResult = client.hsetex(gs("existing_hash"), Map.of(gs("field1"), gs("newValue")), updateOptions).get();
         
      • hgetex

        java.util.concurrent.CompletableFuture<java.lang.String[]> hgetex​(java.lang.String key,
                                                                          java.lang.String[] fields,
                                                                          HGetExOptions options)
        Retrieves the values of specified fields from the hash stored at key and optionally sets their expiration or removes it.
        Parameters:
        key - The key of the hash.
        fields - The fields in the hash stored at key to retrieve from the database.
        options - Optional parameters for the command including expiry settings or persist option. See HGetExOptions.
        Returns:
        An array of values associated with the given fields, in the same order as they are requested.
        For every field that does not exist in the hash, a null value is returned.
        If key does not exist, it returns null.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get fields and set 60 second expiration
         HGetExOptions options = HGetExOptions.builder()
             .expiry(HGetExExpiry.Seconds(60L))
             .build();
         String[] values = client.hgetex("my_hash", new String[] {"field1", "field2"}, options).get();
         assert Arrays.equals(values, new String[] {"value1", "value2"});
        
         // Get fields and remove their expiration (make persistent)
         HGetExOptions persistOptions = HGetExOptions.builder()
             .expiry(HGetExExpiry.Persist())
             .build();
         String[] persistedValues = client.hgetex("my_hash", new String[] {"field1"}, persistOptions).get();
         assert Arrays.equals(persistedValues, new String[] {"value1"});
        
         // Get fields and set expiration to specific Unix timestamp
         HGetExOptions timestampOptions = HGetExOptions.builder()
             .expiry(HGetExExpiry.UnixSeconds(1640995200L))
             .build();
         String[] timestampValues = client.hgetex("my_hash", new String[] {"field1"}, timestampOptions).get();
         
      • hgetex

        java.util.concurrent.CompletableFuture<GlideString[]> hgetex​(GlideString key,
                                                                     GlideString[] fields,
                                                                     HGetExOptions options)
        Retrieves the values of specified fields from the hash stored at key and optionally sets their expiration or removes it.
        Parameters:
        key - The key of the hash.
        fields - The fields in the hash stored at key to retrieve from the database.
        options - Optional parameters for the command including expiry settings or persist option. See HGetExOptions.
        Returns:
        An array of values associated with the given fields, in the same order as they are requested.
        For every field that does not exist in the hash, a null value is returned.
        If key does not exist, it returns null.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get fields and set 60 second expiration
         HGetExOptions options = HGetExOptions.builder()
             .expiry(HGetExExpiry.Seconds(60L))
             .build();
         GlideString[] values = client.hgetex(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2")}, options).get();
         assert Arrays.equals(values, new GlideString[] {gs("value1"), gs("value2")});
        
         // Get fields and remove their expiration (make persistent)
         HGetExOptions persistOptions = HGetExOptions.builder()
             .expiry(HGetExExpiry.Persist())
             .build();
         GlideString[] persistedValues = client.hgetex(gs("my_hash"), new GlideString[] {gs("field1")}, persistOptions).get();
         assert Arrays.equals(persistedValues, new GlideString[] {gs("value1")});
        
         // Get fields and set expiration to specific Unix timestamp
         HGetExOptions timestampOptions = HGetExOptions.builder()
             .expiry(HGetExExpiry.UnixMilliseconds(1640995200000L))
             .build();
         GlideString[] timestampValues = client.hgetex(gs("my_hash"), new GlideString[] {gs("field1")}, timestampOptions).get();
         
      • hexpire

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpire​(java.lang.String key,
                                                                         long seconds,
                                                                         java.lang.String[] fields,
                                                                         HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields. HEXPIRE sets the expiration time in seconds for the specified fields of the hash stored at key. You can specify whether to set the expiration only if the field has no expiration, only if the field has an existing expiration, only if the new expiration is greater than the current one, or only if the new expiration is less than the current one.
        Parameters:
        key - The key of the hash.
        seconds - The expiration time in seconds.
        fields - The fields in the hash stored at key to set expiration for.
        options - The expiration condition options. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values indicating the result of setting expiration for each field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or key does not exist.
        • 2 when called with 0 seconds.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for fields only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hexpire("my_hash", 60L, new String[] {"field1", "field2"}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 0L}); // field1 had no expiry, field2 already had expiry
        
         // Set expiration for fields only if new expiration is greater than current
         HashFieldExpirationConditionOptions gtOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_GREATER_THAN_CURRENT)
             .build();
         Long[] gtResults = client.hexpire("my_hash", 120L, new String[] {"field1"}, gtOptions).get();
         assert Arrays.equals(gtResults, new Long[] {1L}); // 120 > 60, so expiration was updated
        
         // Set expiration for fields only if they have existing expiration
         HashFieldExpirationConditionOptions xxOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_EXISTING_EXPIRY)
             .build();
         Long[] xxResults = client.hexpire("my_hash", 90L, new String[] {"field1"}, xxOptions).get();
         
      • hexpire

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpire​(GlideString key,
                                                                         long seconds,
                                                                         GlideString[] fields,
                                                                         HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields. HEXPIRE sets the expiration time in seconds for the specified fields of the hash stored at key. You can specify whether to set the expiration only if the field has no expiration, only if the field has an existing expiration, only if the new expiration is greater than the current one, or only if the new expiration is less than the current one.
        Parameters:
        key - The key of the hash.
        seconds - The expiration time in seconds.
        fields - The fields in the hash stored at key to set expiration for.
        options - The expiration condition options. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values indicating the result of setting expiration for each field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or key does not exist.
        • 2 when called with 0 seconds.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for fields only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hexpire(gs("my_hash"), 60L, new GlideString[] {gs("field1"), gs("field2")}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 0L}); // field1 had no expiry, field2 already had expiry
        
         // Set expiration for fields only if new expiration is greater than current
         HashFieldExpirationConditionOptions gtOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_GREATER_THAN_CURRENT)
             .build();
         Long[] gtResults = client.hexpire(gs("my_hash"), 120L, new GlideString[] {gs("field1")}, gtOptions).get();
         assert Arrays.equals(gtResults, new Long[] {1L}); // 120 > 60, so expiration was updated
        
         // Set expiration for fields only if they have existing expiration
         HashFieldExpirationConditionOptions xxOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_EXISTING_EXPIRY)
             .build();
         Long[] xxResults = client.hexpire(gs("my_hash"), 90L, new GlideString[] {gs("field1")}, xxOptions).get();
         
      • hpersist

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpersist​(java.lang.String key,
                                                                          java.lang.String[] fields)
        Removes the expiration time for each specified field, turning the field from volatile (a field with expiration time) to persistent (a field that will never expire as no expiration time is associated).
        Parameters:
        key - The key of the hash.
        fields - The fields to remove expiration from.
        Returns:
        An array of Long values, each corresponding to a field:
        • 1 if the expiration time was successfully removed from the field.
        • -1 if the field exists but has no expiration time.
        • -2 if the field does not exist in the provided hash key, or the hash key does not exist.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set fields with expiration
         HSetExOptions options = HSetExOptions.builder()
             .expiry(ExpirySet.Seconds(60L))
             .build();
         client.hsetex("my_hash", Map.of("field1", "value1", "field2", "value2"), options).get();
        
         // Remove expiration from fields
         Long[] results = client.hpersist("my_hash", new String[] {"field1", "field2", "field3"}).get();
         assert Arrays.equals(results, new Long[] {1L, 1L, -2L}); // field1 and field2 had expiry removed, field3 doesn't exist
         
      • hpersist

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpersist​(GlideString key,
                                                                          GlideString[] fields)
        Removes the expiration time for each specified field, turning the field from volatile (a field with expiration time) to persistent (a field that will never expire as no expiration time is associated).
        Parameters:
        key - The key of the hash.
        fields - The fields to remove expiration from.
        Returns:
        An array of Long values, each corresponding to a field:
        • 1 if the expiration time was successfully removed from the field.
        • -1 if the field exists but has no expiration time.
        • -2 if the field does not exist in the provided hash key, or the hash key does not exist.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set fields with expiration
         HSetExOptions options = HSetExOptions.builder()
             .expiry(ExpirySet.Seconds(60L))
             .build();
         client.hsetex(gs("my_hash"), Map.of(gs("field1"), gs("value1"), gs("field2"), gs("value2")), options).get();
        
         // Remove expiration from fields
         Long[] results = client.hpersist(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2"), gs("field3")}).get();
         assert Arrays.equals(results, new Long[] {1L, 1L, -2L}); // field1 and field2 had expiry removed, field3 doesn't exist
         
      • hpexpire

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpire​(java.lang.String key,
                                                                          long milliseconds,
                                                                          java.lang.String[] fields,
                                                                          HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields, in milliseconds. Creates the hash if it doesn't exist. If a field is already expired, it will be deleted rather than expired.
        Parameters:
        key - The key of the hash.
        milliseconds - The expiration time to set for the fields, in milliseconds.
        fields - The fields to set expiration for.
        options - The expiration options. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values, each corresponding to a field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or HASH is empty.
        • 2 when called with 0 milliseconds.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for fields in 5000 milliseconds (5 seconds) only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hpexpire("my_hash", 5000L, new String[] {"field1", "field2"}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 1L}); // Both fields had expiration set
        
         // Set expiration only if new expiration is less than current
         HashFieldExpirationConditionOptions ltOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_LESS_THAN_CURRENT)
             .build();
         Long[] ltResults = client.hpexpire("my_hash", 3000L, new String[] {"field1"}, ltOptions).get();
         
      • hpexpire

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpire​(GlideString key,
                                                                          long milliseconds,
                                                                          GlideString[] fields,
                                                                          HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields, in milliseconds. Creates the hash if it doesn't exist. If a field is already expired, it will be deleted rather than expired.
        Parameters:
        key - The key of the hash.
        milliseconds - The expiration time to set for the fields, in milliseconds.
        fields - The fields to set expiration for.
        options - The expiration options. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values, each corresponding to a field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or HASH is empty.
        • 2 when called with 0 milliseconds.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for fields in 5000 milliseconds (5 seconds) only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hpexpire(gs("my_hash"), 5000L, new GlideString[] {gs("field1"), gs("field2")}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 1L}); // Both fields had expiration set
        
         // Set expiration only if new expiration is less than current
         HashFieldExpirationConditionOptions ltOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_LESS_THAN_CURRENT)
             .build();
         Long[] ltResults = client.hpexpire(gs("my_hash"), 3000L, new GlideString[] {gs("field1")}, ltOptions).get();
         
      • hexpireat

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpireat​(java.lang.String key,
                                                                           long unixSeconds,
                                                                           java.lang.String[] fields,
                                                                           HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields, in seconds, using an absolute Unix timestamp. Creates the hash if it doesn't exist. If a field is already expired, it will be deleted rather than expired.
        Parameters:
        key - The key of the hash.
        unixSeconds - The expiration time to set for the fields, as a Unix timestamp in seconds.
        fields - The fields to set expiration for.
        options - The expiration options. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values, each corresponding to a field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or HASH is empty.
        • 2 when called with 0 seconds or past Unix time.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for fields at Unix timestamp 1672531200 (January 1, 2023) only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hexpireat("my_hash", 1672531200L, new String[] {"field1", "field2"}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 1L}); // Both fields had expiration set
        
         // Set expiration only if new expiration is greater than current
         HashFieldExpirationConditionOptions gtOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_GREATER_THAN_CURRENT)
             .build();
         Long[] gtResults = client.hexpireat("my_hash", 1672617600L, new String[] {"field1"}, gtOptions).get();
         
      • hexpireat

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpireat​(GlideString key,
                                                                           long unixSeconds,
                                                                           GlideString[] fields,
                                                                           HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields, in seconds, using an absolute Unix timestamp. Creates the hash if it doesn't exist. If a field is already expired, it will be deleted rather than expired.
        Parameters:
        key - The key of the hash.
        unixSeconds - The expiration time to set for the fields, as a Unix timestamp in seconds.
        fields - The fields to set expiration for.
        options - The expiration options. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values, each corresponding to a field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or HASH is empty.
        • 2 when called with 0 seconds or past Unix time.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for fields at Unix timestamp 1672531200 (January 1, 2023) only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hexpireat(gs("my_hash"), 1672531200L, new GlideString[] {gs("field1"), gs("field2")}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 1L}); // Both fields had expiration set
        
         // Set expiration only if new expiration is greater than current
         HashFieldExpirationConditionOptions gtOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_GREATER_THAN_CURRENT)
             .build();
         Long[] gtResults = client.hexpireat(gs("my_hash"), 1672617600L, new GlideString[] {gs("field1")}, gtOptions).get();
         
      • hpexpireat

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpireat​(java.lang.String key,
                                                                            long unixMilliseconds,
                                                                            java.lang.String[] fields,
                                                                            HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields, using an absolute Unix timestamp in milliseconds. HPEXPIREAT has the same effect and semantic as HEXPIREAT, but the Unix time at which the field will expire is specified in milliseconds instead of seconds.
        Parameters:
        key - The key of the hash.
        unixMilliseconds - The expiration time to set for the fields, as a Unix timestamp in milliseconds.
        fields - An array of hash field names for which to set the expiration.
        options - Optional conditions and configurations for the expiration. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values indicating the result for each field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or HASH is empty.
        • 2 when called with 0 seconds or past Unix time in milliseconds.
        If unixMilliseconds is in the past, the field will be deleted rather than expired.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for hash fields to January 1, 2024 00:00:00 UTC (in milliseconds) only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hpexpireat("my_hash", 1672531200000L, new String[] {"field1", "field2"}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 1L}); // Both fields had expiration set
        
         // Set expiration only if new expiration is less than current
         HashFieldExpirationConditionOptions ltOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_LESS_THAN_CURRENT)
             .build();
         Long[] ltResults = client.hpexpireat("my_hash", 1672444800000L, new String[] {"field1"}, ltOptions).get();
         
      • hpexpireat

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpireat​(GlideString key,
                                                                            long unixMilliseconds,
                                                                            GlideString[] fields,
                                                                            HashFieldExpirationConditionOptions options)
        Sets expiration time for hash fields, using an absolute Unix timestamp in milliseconds. HPEXPIREAT has the same effect and semantic as HEXPIREAT, but the Unix time at which the field will expire is specified in milliseconds instead of seconds.
        Parameters:
        key - The key of the hash.
        unixMilliseconds - The expiration time to set for the fields, as a Unix timestamp in milliseconds.
        fields - An array of hash field names for which to set the expiration.
        options - Optional conditions and configurations for the expiration. See HashFieldExpirationConditionOptions.
        Returns:
        An array of Long values indicating the result for each field:
        • 1 if the expiration time was successfully set for the field.
        • 0 if the specified condition was not met.
        • -2 if the field does not exist in the HASH, or HASH is empty.
        • 2 when called with 0 seconds or past Unix time in milliseconds.
        If unixMilliseconds is in the past, the field will be deleted rather than expired.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Set expiration for hash fields to January 1, 2024 00:00:00 UTC (in milliseconds) only if they have no existing expiration
         HashFieldExpirationConditionOptions options = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.HAS_NO_EXPIRY)
             .build();
         Long[] results = client.hpexpireat(gs("my_hash"), 1672531200000L, new GlideString[] {gs("field1"), gs("field2")}, options).get();
         assert Arrays.equals(results, new Long[] {1L, 1L}); // Both fields had expiration set
        
         // Set expiration only if new expiration is less than current
         HashFieldExpirationConditionOptions ltOptions = HashFieldExpirationConditionOptions.builder()
             .condition(ExpireOptions.NEW_EXPIRY_LESS_THAN_CURRENT)
             .build();
         Long[] ltResults = client.hpexpireat(gs("my_hash"), 1672444800000L, new GlideString[] {gs("field1")}, ltOptions).get();
         
      • httl

        java.util.concurrent.CompletableFuture<java.lang.Long[]> httl​(java.lang.String key,
                                                                      java.lang.String[] fields)
        Returns the remaining time to live of hash fields that have a timeout, in seconds.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the TTL for.
        Returns:
        An array of Long values, each corresponding to a field:
        • TTL in seconds if the field exists and has a timeout.
        • -1 if the field exists but has no associated expire.
        • -2 if the field does not exist in the provided hash key, or the hash key is empty.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get TTL for hash fields
         Long[] ttls = client.httl("my_hash", new String[] {"field1", "field2", "field3"}).get();
         assert ttls[0] > 0; // field1 has TTL
         assert ttls[1] == -1; // field2 exists but has no expiration
         assert ttls[2] == -2; // field3 does not exist
         
      • httl

        java.util.concurrent.CompletableFuture<java.lang.Long[]> httl​(GlideString key,
                                                                      GlideString[] fields)
        Returns the remaining time to live of hash fields that have a timeout, in seconds.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the TTL for.
        Returns:
        An array of Long values, each corresponding to a field:
        • TTL in seconds if the field exists and has a timeout.
        • -1 if the field exists but has no associated expire.
        • -2 if the field does not exist in the provided hash key, or the hash key is empty.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get TTL for hash fields
         Long[] ttls = client.httl(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2"), gs("field3")}).get();
         assert ttls[0] > 0; // field1 has TTL
         assert ttls[1] == -1; // field2 exists but has no expiration
         assert ttls[2] == -2; // field3 does not exist
         
      • hpttl

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpttl​(java.lang.String key,
                                                                       java.lang.String[] fields)
        Returns the remaining time to live of hash fields that have a timeout, in milliseconds.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the TTL for.
        Returns:
        An array of TTL values in milliseconds for the specified fields:
        • For fields with a timeout, returns the remaining TTL in milliseconds.
        • For fields that exist but have no associated expire, returns -1.
        • For fields that do not exist in the provided hash key, or the hash key is empty, returns -2.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get TTL for hash fields in milliseconds
         Long[] ttls = client.hpttl("my_hash", new String[] {"field1", "field2", "field3"}).get();
         assert ttls[0] > 0; // field1 has TTL in milliseconds
         assert ttls[1] == -1; // field2 exists but has no expiration
         assert ttls[2] == -2; // field3 does not exist
         
      • hpttl

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpttl​(GlideString key,
                                                                       GlideString[] fields)
        Returns the remaining time to live of hash fields that have a timeout, in milliseconds.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the TTL for.
        Returns:
        An array of TTL values in milliseconds for the specified fields:
        • For fields with a timeout, returns the remaining TTL in milliseconds.
        • For fields that exist but have no associated expire, returns -1.
        • For fields that do not exist in the provided hash key, or the hash key is empty, returns -2.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get TTL for hash fields in milliseconds
         Long[] ttls = client.hpttl(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2"), gs("field3")}).get();
         assert ttls[0] > 0; // field1 has TTL in milliseconds
         assert ttls[1] == -1; // field2 exists but has no expiration
         assert ttls[2] == -2; // field3 does not exist
         
      • hexpiretime

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpiretime​(java.lang.String key,
                                                                             java.lang.String[] fields)
        Returns the absolute Unix timestamp (in seconds) at which the given hash fields will expire.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the expiration timestamp for.
        Returns:
        An array of expiration timestamps in seconds for the specified fields:
        • For fields with a timeout, returns the absolute Unix timestamp in seconds.
        • For fields that exist but have no associated expire, returns -1.
        • For fields that do not exist in the provided hash key, or the hash key is empty, returns -2.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get expiration timestamps for hash fields
         Long[] timestamps = client.hexpiretime("my_hash", new String[] {"field1", "field2", "field3"}).get();
         assert timestamps[0] > System.currentTimeMillis() / 1000; // field1 has future expiration
         assert timestamps[1] == -1; // field2 exists but has no expiration
         assert timestamps[2] == -2; // field3 does not exist
         
      • hexpiretime

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hexpiretime​(GlideString key,
                                                                             GlideString[] fields)
        Returns the absolute Unix timestamp (in seconds) at which the given hash fields will expire.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the expiration timestamp for.
        Returns:
        An array of expiration timestamps in seconds for the specified fields:
        • For fields with a timeout, returns the absolute Unix timestamp in seconds.
        • For fields that exist but have no associated expire, returns -1.
        • For fields that do not exist in the provided hash key, or the hash key is empty, returns -2.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get expiration timestamps for hash fields
         Long[] timestamps = client.hexpiretime(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2"), gs("field3")}).get();
         assert timestamps[0] > System.currentTimeMillis() / 1000; // field1 has future expiration
         assert timestamps[1] == -1; // field2 exists but has no expiration
         assert timestamps[2] == -2; // field3 does not exist
         
      • hpexpiretime

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpiretime​(java.lang.String key,
                                                                              java.lang.String[] fields)
        Returns the absolute Unix timestamp (in milliseconds) at which the given hash fields will expire.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the expiration timestamp for.
        Returns:
        An array of expiration timestamps in milliseconds for the specified fields:
        • For fields with a timeout, returns the absolute Unix timestamp in milliseconds.
        • For fields that exist but have no associated expire, returns -1.
        • For fields that do not exist in the provided hash key, or the hash key is empty, returns -2.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get expiration timestamps for hash fields in milliseconds
         Long[] timestamps = client.hpexpiretime("my_hash", new String[] {"field1", "field2", "field3"}).get();
         assert timestamps[0] > System.currentTimeMillis(); // field1 has future expiration
         assert timestamps[1] == -1; // field2 exists but has no expiration
         assert timestamps[2] == -2; // field3 does not exist
         
      • hpexpiretime

        java.util.concurrent.CompletableFuture<java.lang.Long[]> hpexpiretime​(GlideString key,
                                                                              GlideString[] fields)
        Returns the absolute Unix timestamp (in milliseconds) at which the given hash fields will expire.
        Parameters:
        key - The key of the hash.
        fields - The fields to get the expiration timestamp for.
        Returns:
        An array of expiration timestamps in milliseconds for the specified fields:
        • For fields with a timeout, returns the absolute Unix timestamp in milliseconds.
        • For fields that exist but have no associated expire, returns -1.
        • For fields that do not exist in the provided hash key, or the hash key is empty, returns -2.
        Since:
        Valkey 9.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         // Get expiration timestamps for hash fields in milliseconds
         Long[] timestamps = client.hpexpiretime(gs("my_hash"), new GlideString[] {gs("field1"), gs("field2"), gs("field3")}).get();
         assert timestamps[0] > System.currentTimeMillis(); // field1 has future expiration
         assert timestamps[1] == -1; // field2 exists but has no expiration
         assert timestamps[2] == -2; // field3 does not exist