Interface GenericBaseCommands

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DB_VALKEY_API
      Valkey API keyword used to denote the destination db index.
      static java.lang.String REPLACE_VALKEY_API
      Valkey API keyword used to replace the destination key.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source, GlideString destination)
      Copies the value stored at the source to the destination key if the destination key does not yet exist.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source, GlideString destination, boolean replace)
      Copies the value stored at the source to the destination key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source, GlideString destination, long destinationDB)
      Copies the value stored at the source to the destination key on destinationDB.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source, GlideString destination, long destinationDB, boolean replace)
      Copies the value stored at the source to the destination key on destinationDB.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source, java.lang.String destination)
      Copies the value stored at the source to the destination key if the destination key does not yet exist.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source, java.lang.String destination, boolean replace)
      Copies the value stored at the source to the destination key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source, java.lang.String destination, long destinationDB)
      Copies the value stored at the source to the destination key on destinationDB.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source, java.lang.String destination, long destinationDB, boolean replace)
      Copies the value stored at the source to the destination key on destinationDB.
      java.util.concurrent.CompletableFuture<java.lang.Long> del​(GlideString[] keys)
      Removes the specified keys from the database.
      java.util.concurrent.CompletableFuture<java.lang.Long> del​(java.lang.String[] keys)
      Removes the specified keys from the database.
      java.util.concurrent.CompletableFuture<byte[]> dump​(GlideString key)
      Serialize the value stored at key in a Valkey-specific format and return it to the user.
      java.util.concurrent.CompletableFuture<java.lang.Long> exists​(GlideString[] keys)
      Returns the number of keys in keys that exist in the database.
      java.util.concurrent.CompletableFuture<java.lang.Long> exists​(java.lang.String[] keys)
      Returns the number of keys in keys that exist in the database.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(GlideString key, long seconds)
      Sets a timeout on key in seconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(GlideString key, long seconds, ExpireOptions expireOptions)
      Sets a timeout on key in seconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(java.lang.String key, long seconds)
      Sets a timeout on key in seconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(java.lang.String key, long seconds, ExpireOptions expireOptions)
      Sets a timeout on key in seconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(GlideString key, long unixSeconds)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(GlideString key, long unixSeconds, ExpireOptions expireOptions)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(java.lang.String key, long unixSeconds)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(java.lang.String key, long unixSeconds, ExpireOptions expireOptions)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Long> expiretime​(GlideString key)
      Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in seconds.
      To get the expiration with millisecond precision, use pexpiretime(String).
      java.util.concurrent.CompletableFuture<java.lang.Long> expiretime​(java.lang.String key)
      Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in seconds.
      To get the expiration with millisecond precision, use pexpiretime(String).
      java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost, long destinationPort, GlideString key, long destinationDB, long timeout)
      Atomically transfers a key from a source Valkey instance to a destination Valkey instance.
      java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost, long destinationPort, GlideString key, long destinationDB, long timeout, MigrateOptions migrateOptions)
      Atomically transfers a key from a source Valkey instance to a destination Valkey instance.
      java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost, long destinationPort, java.lang.String key, long destinationDB, long timeout)
      Atomically transfers a key from a source Valkey instance to a destination Valkey instance.
      java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost, long destinationPort, java.lang.String key, long destinationDB, long timeout, MigrateOptions migrateOptions)
      Atomically transfers a key from a source Valkey instance to a destination Valkey instance.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> move​(GlideString key, long dbIndex)
      Move key from the currently selected database to the database specified by dbIndex.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> move​(java.lang.String key, long dbIndex)
      Move key from the currently selected database to the database specified by dbIndex.
      java.util.concurrent.CompletableFuture<java.lang.String> objectEncoding​(GlideString key)
      Returns the internal encoding for the Valkey object stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String> objectEncoding​(java.lang.String key)
      Returns the internal encoding for the Valkey object stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> objectFreq​(GlideString key)
      Returns the logarithmic access frequency counter of a Valkey object stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> objectFreq​(java.lang.String key)
      Returns the logarithmic access frequency counter of a Valkey object stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> objectIdletime​(GlideString key)
      Returns the time in seconds since the last access to the value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> objectIdletime​(java.lang.String key)
      Returns the time in seconds since the last access to the value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> objectRefcount​(GlideString key)
      Returns the reference count of the object stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> objectRefcount​(java.lang.String key)
      Returns the reference count of the object stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> persist​(GlideString key)
      Removes the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
      java.util.concurrent.CompletableFuture<java.lang.Boolean> persist​(java.lang.String key)
      Removes the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(GlideString key, long milliseconds)
      Sets a timeout on key in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(GlideString key, long milliseconds, ExpireOptions expireOptions)
      Sets a timeout on key in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(java.lang.String key, long milliseconds)
      Sets a timeout on key in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(java.lang.String key, long milliseconds, ExpireOptions expireOptions)
      Sets a timeout on key in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(GlideString key, long unixMilliseconds)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(GlideString key, long unixMilliseconds, ExpireOptions expireOptions)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(java.lang.String key, long unixMilliseconds)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(java.lang.String key, long unixMilliseconds, ExpireOptions expireOptions)
      Sets a timeout on key.
      java.util.concurrent.CompletableFuture<java.lang.Long> pexpiretime​(GlideString key)
      Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long> pexpiretime​(java.lang.String key)
      Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long> pttl​(GlideString key)
      Returns the remaining time to live of key that has a timeout, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.Long> pttl​(java.lang.String key)
      Returns the remaining time to live of key that has a timeout, in milliseconds.
      java.util.concurrent.CompletableFuture<java.lang.String> rename​(GlideString key, GlideString newKey)
      Renames key to newKey.
      If newKey already exists it is overwritten.
      java.util.concurrent.CompletableFuture<java.lang.String> rename​(java.lang.String key, java.lang.String newKey)
      Renames key to newKey.
      If newKey already exists it is overwritten.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> renamenx​(GlideString key, GlideString newKey)
      Renames key to newKey if newKey does not yet exist.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> renamenx​(java.lang.String key, java.lang.String newKey)
      Renames key to newKey if newKey does not yet exist.
      java.util.concurrent.CompletableFuture<java.lang.String> restore​(GlideString key, long ttl, byte[] value)
      Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via dump(glide.api.models.GlideString)).
      java.util.concurrent.CompletableFuture<java.lang.String> restore​(GlideString key, long ttl, byte[] value, RestoreOptions restoreOptions)
      Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via dump(glide.api.models.GlideString)).
      java.util.concurrent.CompletableFuture<GlideString[]> sort​(GlideString key)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<GlideString[]> sort​(GlideString key, SortOptionsBinary sortOptions)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<java.lang.String[]> sort​(java.lang.String key)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<java.lang.String[]> sort​(java.lang.String key, SortOptions sortOptions)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<GlideString[]> sortReadOnly​(GlideString key)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<GlideString[]> sortReadOnly​(GlideString key, SortOptionsBinary sortOptions)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<java.lang.String[]> sortReadOnly​(java.lang.String key)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<java.lang.String[]> sortReadOnly​(java.lang.String key, SortOptions sortOptions)
      Sorts the elements in the list, set, or sorted set at key and returns the result.
      java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(GlideString key, GlideString destination)
      Sorts the elements in the list, set, or sorted set at key and stores the result in destination.
      java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(GlideString key, GlideString destination, SortOptionsBinary sortOptions)
      Sorts the elements in the list, set, or sorted set at key and stores the result in destination.
      java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(java.lang.String key, java.lang.String destination)
      Sorts the elements in the list, set, or sorted set at key and stores the result in destination.
      java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(java.lang.String key, java.lang.String destination, SortOptions sortOptions)
      Sorts the elements in the list, set, or sorted set at key and stores the result in destination.
      java.util.concurrent.CompletableFuture<java.lang.Long> touch​(GlideString[] keys)
      Updates the last access time of specified keys.
      java.util.concurrent.CompletableFuture<java.lang.Long> touch​(java.lang.String[] keys)
      Updates the last access time of specified keys.
      java.util.concurrent.CompletableFuture<java.lang.Long> ttl​(GlideString key)
      Returns the remaining time to live of key that has a timeout, in seconds.
      java.util.concurrent.CompletableFuture<java.lang.Long> ttl​(java.lang.String key)
      Returns the remaining time to live of key that has a timeout, in seconds.
      java.util.concurrent.CompletableFuture<java.lang.String> type​(GlideString key)
      Returns the string representation of the type of the value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.String> type​(java.lang.String key)
      Returns the string representation of the type of the value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> unlink​(GlideString[] keys)
      Unlink (delete) multiple keys from the database.
      java.util.concurrent.CompletableFuture<java.lang.Long> unlink​(java.lang.String[] keys)
      Unlink (delete) multiple keys from the database.
      java.util.concurrent.CompletableFuture<java.lang.Long> wait​(long numreplicas, long timeout)
      Blocks the current client until all the previous write commands are successfully transferred and acknowledged by at least numreplicas of replicas.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> waitaof​(long numlocal, long numreplicas, long timeout)
      Blocks the current client until all previous write commands are successfully transferred and acknowledged by at least numlocal and numreplicas of replicas.
    • Field Detail

      • REPLACE_VALKEY_API

        static final java.lang.String REPLACE_VALKEY_API
        Valkey API keyword used to replace the destination key.
        See Also:
        Constant Field Values
      • DB_VALKEY_API

        static final java.lang.String DB_VALKEY_API
        Valkey API keyword used to denote the destination db index.
        See Also:
        Constant Field Values
    • Method Detail

      • del

        java.util.concurrent.CompletableFuture<java.lang.Long> del​(java.lang.String[] keys)
        Removes the specified keys from the database. A key is ignored if it does not exist.
        Parameters:
        keys - The keys we wanted to remove.
        Returns:
        The number of keys that were removed.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.del(new String[] {"key1", "key2"}).get();
         assert num == 2L;
         
      • del

        java.util.concurrent.CompletableFuture<java.lang.Long> del​(GlideString[] keys)
        Removes the specified keys from the database. A key is ignored if it does not exist.
        Parameters:
        keys - The keys we wanted to remove.
        Returns:
        The number of keys that were removed.
        See Also:
        valkey.io for details.
        Example:
        
         Long num = client.del(new GlideString[] {gs("key1"), gs("key2")}).get();
         assert num == 2L;
         
      • exists

        java.util.concurrent.CompletableFuture<java.lang.Long> exists​(java.lang.String[] keys)
        Returns the number of keys in keys that exist in the database.
        Parameters:
        keys - The keys list to check.
        Returns:
        The number of keys that exist. If the same existing key is mentioned in keys multiple times, it will be counted multiple times.
        See Also:
        valkey.io for details.
        Example:
        
         Long result = client.exists(new String[] {"my_key", "invalid_key"}).get();
         assert result == 1L;
         
      • exists

        java.util.concurrent.CompletableFuture<java.lang.Long> exists​(GlideString[] keys)
        Returns the number of keys in keys that exist in the database.
        Parameters:
        keys - The keys list to check.
        Returns:
        The number of keys that exist. If the same existing key is mentioned in keys multiple times, it will be counted multiple times.
        See Also:
        valkey.io for details.
        Example:
        
         Long result = client.exists(new GlideString[] {gs("my_key"), gs("invalid_key")}).get();
         assert result == 1L;
         
      • unlink

        java.util.concurrent.CompletableFuture<java.lang.Long> unlink​(java.lang.String[] keys)
        Unlink (delete) multiple keys from the database. A key is ignored if it does not exist. This command, similar to DEL, removes specified keys and ignores non-existent ones. However, this command does not block the server, while DEL does.
        Parameters:
        keys - The list of keys to unlink.
        Returns:
        The number of keys that were unlinked.
        See Also:
        valkey.io for details.
        Example:
        
         Long result = client.unlink(new String[] {"my_key"}).get();
         assert result == 1L;
         
      • unlink

        java.util.concurrent.CompletableFuture<java.lang.Long> unlink​(GlideString[] keys)
        Unlink (delete) multiple keys from the database. A key is ignored if it does not exist. This command, similar to DEL, removes specified keys and ignores non-existent ones. However, this command does not block the server, while DEL does.
        Parameters:
        keys - The list of keys to unlink.
        Returns:
        The number of keys that were unlinked.
        See Also:
        valkey.io for details.
        Example:
        
         Long result = client.unlink(new GlideString[] {gs("my_key")}).get();
         assert result == 1L;
         
      • expire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(java.lang.String key,
                                                                         long seconds)
        Sets a timeout on key in seconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If seconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        seconds - The timeout in seconds.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expire("my_key", 60).get();
         assert isSet; //Indicates that a timeout of 60 seconds has been set for "my_key."
         
      • expire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(GlideString key,
                                                                         long seconds)
        Sets a timeout on key in seconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If seconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        seconds - The timeout in seconds.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expire(gs("my_key"), 60).get();
         assert isSet; //Indicates that a timeout of 60 seconds has been set for gs("my_key").
         
      • expire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(java.lang.String key,
                                                                         long seconds,
                                                                         ExpireOptions expireOptions)
        Sets a timeout on key in seconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If seconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        seconds - The timeout in seconds.
        expireOptions - The expire options.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expire("my_key", 60, ExpireOptions.HAS_NO_EXPIRY).get();
         assert isSet; //Indicates that a timeout of 60 seconds has been set for "my_key".
         
      • expire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expire​(GlideString key,
                                                                         long seconds,
                                                                         ExpireOptions expireOptions)
        Sets a timeout on key in seconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If seconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        seconds - The timeout in seconds.
        expireOptions - The expire options.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expire(gs("my_key"), 60, ExpireOptions.HAS_NO_EXPIRY).get();
         assert isSet; //Indicates that a timeout of 60 seconds has been set for gs("my_key").
         
      • expireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(java.lang.String key,
                                                                           long unixSeconds)
        Sets a timeout on key. It takes an absolute Unix timestamp (seconds since January 1, 1970) instead of specifying the number of seconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixSeconds - The timeout in an absolute Unix timestamp.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expireAt("my_key", Instant.now().getEpochSecond() + 10).get();
         assert isSet;
         
      • expireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(GlideString key,
                                                                           long unixSeconds)
        Sets a timeout on key. It takes an absolute Unix timestamp (seconds since January 1, 1970) instead of specifying the number of seconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixSeconds - The timeout in an absolute Unix timestamp.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expireAt(gs("my_key"), Instant.now().getEpochSecond() + 10).get();
         assert isSet;
         
      • expireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(java.lang.String key,
                                                                           long unixSeconds,
                                                                           ExpireOptions expireOptions)
        Sets a timeout on key. It takes an absolute Unix timestamp (seconds since January 1, 1970) instead of specifying the number of seconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixSeconds - The timeout in an absolute Unix timestamp.
        expireOptions - The expire options.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expireAt("my_key", Instant.now().getEpochSecond() + 10, ExpireOptions.HasNoExpiry).get();
         assert isSet;
         
      • expireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> expireAt​(GlideString key,
                                                                           long unixSeconds,
                                                                           ExpireOptions expireOptions)
        Sets a timeout on key. It takes an absolute Unix timestamp (seconds since January 1, 1970) instead of specifying the number of seconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixSeconds - The timeout in an absolute Unix timestamp.
        expireOptions - The expire options.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.expireAt(gs("my_key"), Instant.now().getEpochSecond() + 10, ExpireOptions.HasNoExpiry).get();
         assert isSet;
         
      • pexpire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(java.lang.String key,
                                                                          long milliseconds)
        Sets a timeout on key in milliseconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If milliseconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        milliseconds - The timeout in milliseconds.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpire("my_key", 60000).get();
         assert isSet;
         
      • pexpire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(GlideString key,
                                                                          long milliseconds)
        Sets a timeout on key in milliseconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If milliseconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        milliseconds - The timeout in milliseconds.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpire(gs("my_key"), 60000).get();
         assert isSet;
         
      • pexpire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(java.lang.String key,
                                                                          long milliseconds,
                                                                          ExpireOptions expireOptions)
        Sets a timeout on key in milliseconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If milliseconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        milliseconds - The timeout in milliseconds.
        expireOptions - The expire options.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpire("my_key", 60000, ExpireOptions.HasNoExpiry).get();
         assert isSet;
         
      • pexpire

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpire​(GlideString key,
                                                                          long milliseconds,
                                                                          ExpireOptions expireOptions)
        Sets a timeout on key in milliseconds. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        If milliseconds is a non-positive number, the key will be deleted rather than expired.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        milliseconds - The timeout in milliseconds.
        expireOptions - The expire options.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpire(gs("my_key"), 60000, ExpireOptions.HasNoExpiry).get();
         assert isSet;
         
      • pexpireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(java.lang.String key,
                                                                            long unixMilliseconds)
        Sets a timeout on key. It takes an absolute Unix timestamp (milliseconds since January 1, 1970) instead of specifying the number of milliseconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixMilliseconds - The timeout in an absolute Unix timestamp.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpireAt("my_key", Instant.now().toEpochMilli() + 10).get();
         assert isSet;
         
      • pexpireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(GlideString key,
                                                                            long unixMilliseconds)
        Sets a timeout on key. It takes an absolute Unix timestamp (milliseconds since January 1, 1970) instead of specifying the number of milliseconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixMilliseconds - The timeout in an absolute Unix timestamp.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpireAt(gs("my_key"), Instant.now().toEpochMilli() + 10).get();
         assert isSet;
         
      • pexpireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(java.lang.String key,
                                                                            long unixMilliseconds,
                                                                            ExpireOptions expireOptions)
        Sets a timeout on key. It takes an absolute Unix timestamp (milliseconds since January 1, 1970) instead of specifying the number of milliseconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixMilliseconds - The timeout in an absolute Unix timestamp.
        expireOptions - The expire option.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpireAt("my_key", Instant.now().toEpochMilli() + 10, ExpireOptions.HasNoExpiry).get();
         assert isSet;
         
      • pexpireAt

        java.util.concurrent.CompletableFuture<java.lang.Boolean> pexpireAt​(GlideString key,
                                                                            long unixMilliseconds,
                                                                            ExpireOptions expireOptions)
        Sets a timeout on key. It takes an absolute Unix timestamp (milliseconds since January 1, 1970) instead of specifying the number of milliseconds.
        A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be deleted.
        If key already has an existing expire set, the time to live is updated to the new value.
        The timeout will only be cleared by commands that delete or overwrite the contents of key .
        Parameters:
        key - The key to set timeout on it.
        unixMilliseconds - The timeout in an absolute Unix timestamp.
        expireOptions - The expire option.
        Returns:
        true if the timeout was set. false if the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean isSet = client.pexpireAt(gs("my_key"), Instant.now().toEpochMilli() + 10, ExpireOptions.HasNoExpiry).get();
         assert isSet;
         
      • ttl

        java.util.concurrent.CompletableFuture<java.lang.Long> ttl​(java.lang.String key)
        Returns the remaining time to live of key that has a timeout, in seconds.
        Parameters:
        key - The key to return its timeout.
        Returns:
        TTL in seconds, -2 if key does not exist, or -1 if key exists but has no associated expiration.
        See Also:
        valkey.io for details.
        Example:
        
         Long timeRemaining = client.ttl("my_key").get();
         assert timeRemaining == 3600L; //Indicates that "my_key" has a remaining time to live of 3600 seconds.
        
         Long timeRemaining = client.ttl("nonexistent_key").get();
         assert timeRemaining == -2L; //Returns -2 for a non-existing key.
         
      • ttl

        java.util.concurrent.CompletableFuture<java.lang.Long> ttl​(GlideString key)
        Returns the remaining time to live of key that has a timeout, in seconds.
        Parameters:
        key - The key to return its timeout.
        Returns:
        TTL in seconds, -2 if key does not exist, or -1 if key exists but has no associated expiration.
        See Also:
        valkey.io for details.
        Example:
        
         Long timeRemaining = client.ttl(gs("my_key")).get();
         assert timeRemaining == 3600L; //Indicates that gs("my_key") has a remaining time to live of 3600 seconds.
        
         Long timeRemaining = client.ttl(gs("nonexistent_key")).get();
         assert timeRemaining == -2L; //Returns -2 for a non-existing key.
         
      • expiretime

        java.util.concurrent.CompletableFuture<java.lang.Long> expiretime​(java.lang.String key)
        Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in seconds.
        To get the expiration with millisecond precision, use pexpiretime(String).
        Parameters:
        key - The key to determine the expiration value of.
        Returns:
        The expiration Unix timestamp in seconds. -2 if key does not exist, or -1 if key exists but has no associated expiration.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         Long expiration = client.expiretime("my_key").get();
         System.out.printf("The key expires at %d epoch time", expiration);
         
      • expiretime

        java.util.concurrent.CompletableFuture<java.lang.Long> expiretime​(GlideString key)
        Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in seconds.
        To get the expiration with millisecond precision, use pexpiretime(String).
        Parameters:
        key - The key to determine the expiration value of.
        Returns:
        The expiration Unix timestamp in seconds. -2 if key does not exist, or -1 if key exists but has no associated expiration.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         Long expiration = client.expiretime(gs("my_key")).get();
         System.out.printf("The key expires at %d epoch time", expiration);
         
      • pexpiretime

        java.util.concurrent.CompletableFuture<java.lang.Long> pexpiretime​(java.lang.String key)
        Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in milliseconds.
        Parameters:
        key - The key to determine the expiration value of.
        Returns:
        The expiration Unix timestamp in milliseconds. -2 if key does not exist, or -1 if key exists but has no associated expiration.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         Long expiration = client.pexpiretime("my_key").get();
         System.out.printf("The key expires at %d epoch time (ms)", expiration);
         
      • pexpiretime

        java.util.concurrent.CompletableFuture<java.lang.Long> pexpiretime​(GlideString key)
        Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire, in milliseconds.
        Parameters:
        key - The key to determine the expiration value of.
        Returns:
        The expiration Unix timestamp in milliseconds. -2 if key does not exist, or -1 if key exists but has no associated expiration.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         Long expiration = client.pexpiretime(gs("my_key")).get();
         System.out.printf("The key expires at %d epoch time (ms)", expiration);
         
      • pttl

        java.util.concurrent.CompletableFuture<java.lang.Long> pttl​(java.lang.String key)
        Returns the remaining time to live of key that has a timeout, in milliseconds.
        Parameters:
        key - The key to return its timeout.
        Returns:
        TTL in milliseconds. -2 if key does not exist, -1 if key exists but has no associated expire.
        See Also:
        valkey.io for details.
        Example:
        
         Long timeRemainingMS = client.pttl("my_key").get()
         assert timeRemainingMS == 5000L // Indicates that "my_key" has a remaining time to live of 5000 milliseconds.
        
         Long timeRemainingMS = client.pttl("nonexistent_key").get();
         assert timeRemainingMS == -2L; // Returns -2 for a non-existing key.
         
      • pttl

        java.util.concurrent.CompletableFuture<java.lang.Long> pttl​(GlideString key)
        Returns the remaining time to live of key that has a timeout, in milliseconds.
        Parameters:
        key - The key to return its timeout.
        Returns:
        TTL in milliseconds. -2 if key does not exist, -1 if key exists but has no associated expire.
        See Also:
        valkey.io for details.
        Example:
        
         Long timeRemainingMS = client.pttl(gs("my_key")).get()
         assert timeRemainingMS == 5000L // Indicates that gs("my_key") has a remaining time to live of 5000 milliseconds.
        
         Long timeRemainingMS = client.pttl(gs("nonexistent_key")).get();
         assert timeRemainingMS == -2L; // Returns -2 for a non-existing key.
         
      • persist

        java.util.concurrent.CompletableFuture<java.lang.Boolean> persist​(java.lang.String key)
        Removes the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
        Parameters:
        key - The key to remove the existing timeout on.
        Returns:
        false if key does not exist or does not have an associated timeout, true if the timeout has been removed.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean timeoutRemoved = client.persist("my_key").get();
         assert timeoutRemoved; // Indicates that the timeout associated with the key "my_key" was successfully removed.
         
      • persist

        java.util.concurrent.CompletableFuture<java.lang.Boolean> persist​(GlideString key)
        Removes the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
        Parameters:
        key - The key to remove the existing timeout on.
        Returns:
        false if key does not exist or does not have an associated timeout, true if the timeout has been removed.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean timeoutRemoved = client.persist(gs("my_key")).get();
         assert timeoutRemoved; // Indicates that the timeout associated with the key "my_key" was successfully removed.
         
      • type

        java.util.concurrent.CompletableFuture<java.lang.String> type​(java.lang.String key)
        Returns the string representation of the type of the value stored at key.
        Parameters:
        key - The key to check its data type.
        Returns:
        If the key exists, the type of the stored value is returned. Otherwise, a "none" string is returned.
        See Also:
        valkey.io for details.
        Example:
        
         String type = client.type("StringKey").get();
         assert type.equals("string");
        
         type = client.type("ListKey").get();
         assert type.equals("list");
         
      • type

        java.util.concurrent.CompletableFuture<java.lang.String> type​(GlideString key)
        Returns the string representation of the type of the value stored at key.
        Parameters:
        key - The key to check its data type.
        Returns:
        If the key exists, the type of the stored value is returned. Otherwise, a "none" string is returned.
        See Also:
        valkey.io for details.
        Example:
        
         String type = client.type(gs("StringKey")).get();
         assert type.equals("string");
        
         type = client.type(gs("ListKey")).get();
         assert type.equals("list");
         
      • objectEncoding

        java.util.concurrent.CompletableFuture<java.lang.String> objectEncoding​(java.lang.String key)
        Returns the internal encoding for the Valkey object stored at key.
        Parameters:
        key - The key of the object to get the internal encoding of.
        Returns:
        If key exists, returns the internal encoding of the object stored at key as a String. Otherwise, returns null.
        See Also:
        valkey.io for details.
        Example:
        
         String encoding = client.objectEncoding("my_hash").get();
         assert encoding.equals("listpack");
        
         encoding = client.objectEncoding("non_existing_key").get();
         assert encoding == null;
         
      • objectEncoding

        java.util.concurrent.CompletableFuture<java.lang.String> objectEncoding​(GlideString key)
        Returns the internal encoding for the Valkey object stored at key.
        Parameters:
        key - The key of the object to get the internal encoding of.
        Returns:
        If key exists, returns the internal encoding of the object stored at key as a String. Otherwise, returns null.
        See Also:
        valkey.io for details.
        Example:
        
         String encoding = client.objectEncoding(gs("my_hash")).get();
         assert encoding.equals("listpack");
        
         encoding = client.objectEncoding(gs("non_existing_key")).get();
         assert encoding == null;
         
      • objectFreq

        java.util.concurrent.CompletableFuture<java.lang.Long> objectFreq​(java.lang.String key)
        Returns the logarithmic access frequency counter of a Valkey object stored at key.
        Parameters:
        key - The key of the object to get the logarithmic access frequency counter of.
        Returns:
        If key exists, returns the logarithmic access frequency counter of the object stored at key as a Long. Otherwise, returns null .
        See Also:
        valkey.io for details.
        Example:
        
         Long frequency = client.objectFreq("my_hash").get();
         assert frequency == 2L;
        
         frequency = client.objectFreq("non_existing_key").get();
         assert frequency == null;
         
      • objectFreq

        java.util.concurrent.CompletableFuture<java.lang.Long> objectFreq​(GlideString key)
        Returns the logarithmic access frequency counter of a Valkey object stored at key.
        Parameters:
        key - The key of the object to get the logarithmic access frequency counter of.
        Returns:
        If key exists, returns the logarithmic access frequency counter of the object stored at key as a Long. Otherwise, returns null .
        See Also:
        valkey.io for details.
        Example:
        
         Long frequency = client.objectFreq(gs("my_hash")).get();
         assert frequency == 2L;
        
         frequency = client.objectFreq(gs("non_existing_key")).get();
         assert frequency == null;
         
      • objectIdletime

        java.util.concurrent.CompletableFuture<java.lang.Long> objectIdletime​(java.lang.String key)
        Returns the time in seconds since the last access to the value stored at key.
        Parameters:
        key - The key of the object to get the idle time of.
        Returns:
        If key exists, returns the idle time in seconds. Otherwise, returns null.
        See Also:
        valkey.io for details.
        Example:
        
         Long idletime = client.objectIdletime("my_hash").get();
         assert idletime == 2L;
        
         idletime = client.objectIdletime("non_existing_key").get();
         assert idletime == null;
         
      • objectIdletime

        java.util.concurrent.CompletableFuture<java.lang.Long> objectIdletime​(GlideString key)
        Returns the time in seconds since the last access to the value stored at key.
        Parameters:
        key - The key of the object to get the idle time of.
        Returns:
        If key exists, returns the idle time in seconds. Otherwise, returns null.
        See Also:
        valkey.io for details.
        Example:
        
         Long idletime = client.objectIdletime(gs("my_hash")).get();
         assert idletime == 2L;
        
         idletime = client.objectIdletime(gs("non_existing_key")).get();
         assert idletime == null;
         
      • objectRefcount

        java.util.concurrent.CompletableFuture<java.lang.Long> objectRefcount​(java.lang.String key)
        Returns the reference count of the object stored at key.
        Parameters:
        key - The key of the object to get the reference count of.
        Returns:
        If key exists, returns the reference count of the object stored at key as a Long. Otherwise, returns null.
        See Also:
        valkey.io for details.
        Example:
        
         Long refcount = client.objectRefcount("my_hash").get();
         assert refcount == 2L;
        
         refcount = client.objectRefcount("non_existing_key").get();
         assert refcount == null;
         
      • objectRefcount

        java.util.concurrent.CompletableFuture<java.lang.Long> objectRefcount​(GlideString key)
        Returns the reference count of the object stored at key.
        Parameters:
        key - The key of the object to get the reference count of.
        Returns:
        If key exists, returns the reference count of the object stored at key as a Long. Otherwise, returns null.
        See Also:
        valkey.io for details.
        Example:
        
         Long refcount = client.objectRefcount(gs("my_hash")).get();
         assert refcount == 2L;
        
         refcount = client.objectRefcount(gs("non_existing_key")).get();
         assert refcount == null;
         
      • rename

        java.util.concurrent.CompletableFuture<java.lang.String> rename​(java.lang.String key,
                                                                        java.lang.String newKey)
        Renames key to newKey.
        If newKey already exists it is overwritten.
        Parameters:
        key - The key to rename.
        newKey - The new name of the key.
        Returns:
        If the key was successfully renamed, return "OK". If key does not exist, an error is thrown.
        See Also:
        valkey.io for details.
        Example:
        
         String value = client.set("key", "value").get();
         value = client.rename("key", "newKeyName").get();
         assert value.equals("OK");
         
      • rename

        java.util.concurrent.CompletableFuture<java.lang.String> rename​(GlideString key,
                                                                        GlideString newKey)
        Renames key to newKey.
        If newKey already exists it is overwritten.
        Parameters:
        key - The key to rename.
        newKey - The new name of the key.
        Returns:
        If the key was successfully renamed, return "OK". If key does not exist, an error is thrown.
        See Also:
        valkey.io for details.
        Example:
        
         String value = client.set(gs("key"), gs("value")).get();
         value = client.rename(gs("key"), gs("newKeyName")).get();
         assert value.equals("OK");
         
      • renamenx

        java.util.concurrent.CompletableFuture<java.lang.Boolean> renamenx​(java.lang.String key,
                                                                           java.lang.String newKey)
        Renames key to newKey if newKey does not yet exist.
        Parameters:
        key - The key to rename.
        newKey - The new key name.
        Returns:
        true if key was renamed to newKey, false if newKey already exists.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean renamed = client.renamenx("old_key", "new_key").get();
         assert renamed;
         
      • renamenx

        java.util.concurrent.CompletableFuture<java.lang.Boolean> renamenx​(GlideString key,
                                                                           GlideString newKey)
        Renames key to newKey if newKey does not yet exist.
        Parameters:
        key - The key to rename.
        newKey - The new key name.
        Returns:
        true if key was renamed to newKey, false if newKey already exists.
        See Also:
        valkey.io for details.
        Example:
        
         Boolean renamed = client.renamenx(gs("old_key"), gs("new_key")).get();
         assert renamed;
         
      • touch

        java.util.concurrent.CompletableFuture<java.lang.Long> touch​(java.lang.String[] keys)
        Updates the last access time of specified keys.
        Parameters:
        keys - The keys to update last access time.
        Returns:
        The number of keys that were updated.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.touch(new String[] {"myKey1", "myKey2", "nonExistentKey"}).get();
         assert payload == 2L; // Last access time of 2 keys has been updated.
         
      • touch

        java.util.concurrent.CompletableFuture<java.lang.Long> touch​(GlideString[] keys)
        Updates the last access time of specified keys.
        Parameters:
        keys - The keys to update last access time.
        Returns:
        The number of keys that were updated.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.touch(new GlideString[] {gs("myKey1"), gs("myKey2"), gs("nonExistentKey")}).get();
         assert payload == 2L; // Last access time of 2 keys has been updated.
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source,
                                                                       java.lang.String destination)
        Copies the value stored at the source to the destination key if the destination key does not yet exist.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("test1", "one").get();
         client.set("test2", "two").get();
         assert !client.copy("test1", "test2").get();
         assert client.copy("test1", "test2").get();
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source,
                                                                       GlideString destination)
        Copies the value stored at the source to the destination key if the destination key does not yet exist.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("test1"), gs("one")).get();
         client.set(gs("test2"), gs("two")).get();
         assert !client.copy(gs("test1", gs("test2")).get();
         assert client.copy(gs("test1"), gs("test2")).get();
         
      • move

        java.util.concurrent.CompletableFuture<java.lang.Boolean> move​(java.lang.String key,
                                                                       long dbIndex)
        Move key from the currently selected database to the database specified by dbIndex.
        Parameters:
        key - The key to move.
        dbIndex - The index of the database to move key to.
        Returns:
        true if key was moved, or false if the key already exists in the destination database or does not exist in the source database.
        See Also:
        valkey.io for more details.
        Example:
        
         Boolean moved = client.move("some_key", 1L).get();
         assert moved;
         
      • move

        java.util.concurrent.CompletableFuture<java.lang.Boolean> move​(GlideString key,
                                                                       long dbIndex)
        Move key from the currently selected database to the database specified by dbIndex.
        Parameters:
        key - The key to move.
        dbIndex - The index of the database to move key to.
        Returns:
        true if key was moved, or false if the key already exists in the destination database or does not exist in the source database.
        See Also:
        valkey.io for more details.
        Example:
        
         Boolean moved = client.move(gs("some_key"), 1L).get();
         assert moved;
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source,
                                                                       java.lang.String destination,
                                                                       boolean replace)
        Copies the value stored at the source to the destination key. When replace is true, removes the destination key first if it already exists, otherwise performs no action.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        replace - If the destination key should be removed before copying the value to it.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("test1", "one").get();
         client.set("test2", "two").get();
         assert !client.copy("test1", "test2", false).get();
         assert client.copy("test1", "test2", true).get();
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source,
                                                                       GlideString destination,
                                                                       boolean replace)
        Copies the value stored at the source to the destination key. When replace is true, removes the destination key first if it already exists, otherwise performs no action.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        replace - If the destination key should be removed before copying the value to it.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("test1"), gs("one")).get();
         client.set(gs("test2"), gs("two")).get();
         assert !client.copy(gs("test1", gs("test2"), false).get();
         assert client.copy(gs("test1", gs("test2"), true).get();
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source,
                                                                       java.lang.String destination,
                                                                       long destinationDB,
                                                                       boolean replace)
        Copies the value stored at the source to the destination key on destinationDB. When replace is true, removes the destination key first if it already exists, otherwise performs no action.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        destinationDB - The alternative logical database index for the destination key.
        replace - If the destination key should be removed before copying the value to it.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above for standalone Client.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("test1", "one").get();
         assert client.copy("test1", "test2", 1, false).get();
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source,
                                                                       GlideString destination,
                                                                       long destinationDB,
                                                                       boolean replace)
        Copies the value stored at the source to the destination key on destinationDB. When replace is true, removes the destination key first if it already exists, otherwise performs no action.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        destinationDB - The alternative logical database index for the destination key.
        replace - If the destination key should be removed before copying the value to it.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above for standalone Client.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("test1"), gs("one")).get();
         assert client.copy(gs("test1"), gs("test2"), 1, false).get();
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(java.lang.String source,
                                                                       java.lang.String destination,
                                                                       long destinationDB)
        Copies the value stored at the source to the destination key on destinationDB. When replace is true, removes the destination key first if it already exists, otherwise performs no action.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        destinationDB - The alternative logical database index for the destination key.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above for standalone Client.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("test1", "one").get();
         assert client.copy("test1", "test2", 1).get();
         
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Boolean> copy​(GlideString source,
                                                                       GlideString destination,
                                                                       long destinationDB)
        Copies the value stored at the source to the destination key on destinationDB. When replace is true, removes the destination key first if it already exists, otherwise performs no action.
        Parameters:
        source - The key to the source value.
        destination - The key where the value should be copied to.
        destinationDB - The alternative logical database index for the destination key.
        Returns:
        true if source was copied, false if source was not copied.
        Since:
        Valkey 6.2.0 and above for standalone Client.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("test1"), gs("one")).get();
         assert client.copy(gs("test1"), gs("test2"), 1).get();
         
      • dump

        java.util.concurrent.CompletableFuture<byte[]> dump​(GlideString key)
        Serialize the value stored at key in a Valkey-specific format and return it to the user.
        Parameters:
        key - The key to serialize.
        Returns:
        The serialized value of the data stored at key.
        If key does not exist, null will be returned.
        See Also:
        valkey.io for details.
        Example:
        
         byte[] result = client.dump("myKey").get();
        
         byte[] response = client.dump("nonExistingKey").get();
         assert response.equals(null);
         
      • restore

        java.util.concurrent.CompletableFuture<java.lang.String> restore​(GlideString key,
                                                                         long ttl,
                                                                         byte[] value)
        Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via dump(glide.api.models.GlideString)).
        Parameters:
        key - The key to create.
        ttl - The expiry time (in milliseconds). If 0, the key will persist.
        value - The serialized value to deserialize and assign to key.
        Returns:
        Return OK if successfully create a key with a value .
        See Also:
        valkey.io for details.
        Example:
        
         String result = client.restore(gs("newKey"), 0, value).get();
         assert result.equals("OK");
         
      • restore

        java.util.concurrent.CompletableFuture<java.lang.String> restore​(GlideString key,
                                                                         long ttl,
                                                                         byte[] value,
                                                                         RestoreOptions restoreOptions)
        Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via dump(glide.api.models.GlideString)).
        Parameters:
        key - The key to create.
        ttl - The expiry time (in milliseconds). If 0, the key will persist.
        value - The serialized value to deserialize and assign to key.
        restoreOptions - The restore options. See RestoreOptions.
        Returns:
        Return OK if successfully create a key with a value .
        See Also:
        valkey.io for details.
        Example:
        
         RestoreOptions options = RestoreOptions.builder().replace().absttl().idletime(10).frequency(10).build()).get();
         // Set restore options with replace and absolute TTL modifiers, object idletime and frequency to 10.
         String result = client.restore(gs("newKey"), 0, value, options).get();
         assert result.equals("OK");
         
      • sort

        java.util.concurrent.CompletableFuture<java.lang.String[]> sort​(java.lang.String key)
        Sorts the elements in the list, set, or sorted set at key and returns the result.
        The sort command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        To store the result into a new key, see sortStore(String, String).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        Returns:
        An Array of sorted elements.
        See Also:
        valkey.io for details.
        Example:
        
         client.lpush("mylist", new String[] {"3", "1", "2"}).get();
         assertArrayEquals(new String[] {"1", "2", "3"}, client.sort("mylist").get()); // List is sorted in ascending order
         
      • sort

        java.util.concurrent.CompletableFuture<GlideString[]> sort​(GlideString key)
        Sorts the elements in the list, set, or sorted set at key and returns the result.
        The sort command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        To store the result into a new key, see sortStore(String, String).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        Returns:
        An Array of sorted elements.
        See Also:
        valkey.io for details.
        Example:
        
         client.lpush(gs("mylist"), new GlideString[] {gs("3"), gs("1"), gs("2")}).get();
         assertArrayEquals(new GlideString[] {gs("1"), gs("2"), gs("3")}, client.sort(gs("mylist")).get()); // List is sorted in ascending order
         
      • sort

        java.util.concurrent.CompletableFuture<java.lang.String[]> sort​(java.lang.String key,
                                                                        SortOptions sortOptions)
        Sorts the elements in the list, set, or sorted set at key and returns the result. The sort command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        To store the result into a new key, see sortStore(String, String, SortOptions).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        sortOptions - The SortOptions.
        Returns:
        An Array of sorted elements.
        See Also:
        valkey.io for details.
        Example:
        
         client.hset("user:1", Map.of("name", "Alice", "age", "30")).get();
         client.hset("user:2", Map.of("name", "Bob", "age", "25")).get();
         client.lpush("user_ids", new String[] {"2", "1"}).get();
         String [] payload = client.sort("user_ids", SortOptions.builder().byPattern("user:*->age")
                          .getPattern("user:*->name").build()).get();
         assertArrayEquals(new String[] {"Bob", "Alice"}, payload); // Returns a list of the names sorted by age
         
      • sort

        java.util.concurrent.CompletableFuture<GlideString[]> sort​(GlideString key,
                                                                   SortOptionsBinary sortOptions)
        Sorts the elements in the list, set, or sorted set at key and returns the result. The sort command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        To store the result into a new key, see #sortStore(GlideString, GlideString, SortOptions).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        sortOptions - The SortOptionsBinary.
        Returns:
        An Array of sorted elements.
        See Also:
        valkey.io for details.
        Example:
        
         client.hset(gs("user:1"), Map.of(gs("name"), gs("Alice"), gs("age"), gs("30"))).get();
         client.hset(gs("user:2"), Map.of(gs("name"), gs("Bob"), gs("age"), gs("25"))).get();
         client.lpush(gs("user_ids"), new GlideString[] {gs("2"), gs("1")}).get();
         GlideString [] payload = client.sort(gs("user_ids"), SortOptionsBinary.builder().byPattern(gs("user:*->age"))
                          .getPattern(gs("user:*->name")).build()).get();
         assertArrayEquals(new GlideString[] {gs("Bob"), gs("Alice")}, payload); // Returns a list of the names sorted by age
         
      • sortReadOnly

        java.util.concurrent.CompletableFuture<java.lang.String[]> sortReadOnly​(java.lang.String key)
        Sorts the elements in the list, set, or sorted set at key and returns the result.
        The sortReadOnly command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        This command is routed depending on the client's ReadFrom strategy.
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        Returns:
        An Array of sorted elements.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.lpush("mylist", new String[] {"3", "1", "2"}).get();
         assertArrayEquals(new String[] {"1", "2", "3"}, client.sortReadOnly("mylist").get()); // List is sorted in ascending order
         
      • sortReadOnly

        java.util.concurrent.CompletableFuture<GlideString[]> sortReadOnly​(GlideString key)
        Sorts the elements in the list, set, or sorted set at key and returns the result.
        The sortReadOnly command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        This command is routed depending on the client's ReadFrom strategy.
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        Returns:
        An Array of sorted elements.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.lpush(gs("mylist", new GlideString[] {gs("3"), gs("1"), gs("2")}).get();
         assertArrayEquals(new GlideString[] {gs("1"), gs("2"), gs("3")}, client.sortReadOnly(gs("mylist")).get()); // List is sorted in ascending order
         
      • sortReadOnly

        java.util.concurrent.CompletableFuture<java.lang.String[]> sortReadOnly​(java.lang.String key,
                                                                                SortOptions sortOptions)
        Sorts the elements in the list, set, or sorted set at key and returns the result. The sortReadOnly command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        This command is routed depending on the client's ReadFrom strategy.
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        sortOptions - The SortOptions.
        Returns:
        An Array of sorted elements.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.hset("user:1", Map.of("name", "Alice", "age", "30")).get();
         client.hset("user:2", Map.of("name", "Bob", "age", "25")).get();
         client.lpush("user_ids", new String[] {"2", "1"}).get();
         String [] payload = client.sortReadOnly("user_ids", SortOptions.builder().byPattern("user:*->age")
                          .getPattern("user:*->name").build()).get();
         assertArrayEquals(new String[] {"Bob", "Alice"}, payload); // Returns a list of the names sorted by age
         
      • sortReadOnly

        java.util.concurrent.CompletableFuture<GlideString[]> sortReadOnly​(GlideString key,
                                                                           SortOptionsBinary sortOptions)
        Sorts the elements in the list, set, or sorted set at key and returns the result. The sortReadOnly command can be used to sort elements based on different criteria and apply transformations on sorted elements.
        This command is routed depending on the client's ReadFrom strategy.
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        sortOptions - The SortOptions.
        Returns:
        An Array of sorted elements.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.hset(gs("user:1"), Map.of(gs("name"), gs("Alice"), gs("age"), gs("30"))).get();
         client.hset(gs("user:2"), Map.of(gs("name"), gs("Bob"), gs("age"), gs("25"))).get();
         client.lpush("user_ids", new GlideString[] {gs("2"), gs("1")}).get();
         GlideString [] payload = client.sortReadOnly(gs("user_ids"), SortOptionsBinary.builder().byPattern(gs("user:*->age"))
                          .getPattern(gs("user:*->name")).build()).get();
         assertArrayEquals(new GlideString[] {gs("Bob"), gs("Alice")}, payload); // Returns a list of the names sorted by age
         
      • sortStore

        java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(java.lang.String key,
                                                                         java.lang.String destination)
        Sorts the elements in the list, set, or sorted set at key and stores the result in destination. The sort command can be used to sort elements based on different criteria, apply transformations on sorted elements, and store the result in a new key.
        To get the sort result without storing it into a key, see sort(String) or sortReadOnly(String).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        destination - The key where the sorted result will be stored.
        Returns:
        The number of elements in the sorted key stored at destination.
        See Also:
        valkey.io for details.
        Example:
        
         client.lpush("mylist", new String[] {"3", "1", "2"}).get();
         assert client.sortStore("mylist", "destination").get() == 3;
         assertArrayEquals(
            new String[] {"1", "2", "3"},
            client.lrange("destination", 0, -1).get()); // Sorted list is stored in `destination`
         
      • sortStore

        java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(GlideString key,
                                                                         GlideString destination)
        Sorts the elements in the list, set, or sorted set at key and stores the result in destination. The sort command can be used to sort elements based on different criteria, apply transformations on sorted elements, and store the result in a new key.
        To get the sort result without storing it into a key, see sort(GlideString) or sortReadOnly(GlideString).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        destination - The key where the sorted result will be stored.
        Returns:
        The number of elements in the sorted key stored at destination.
        See Also:
        valkey.io for details.
        Example:
        
         client.lpush(gs("mylist"), new GlideString[] {gs("3"), gs("1"), gs("2")}).get();
         assert client.sortStore(gs("mylist"), gs("destination")).get() == 3;
         assertArrayEquals(
            new GlideString[] {gs("1"), gs("2"), gs("3")},
            client.lrange(gs("destination"), 0, -1).get()); // Sorted list is stored in `destination`
         
      • sortStore

        java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(java.lang.String key,
                                                                         java.lang.String destination,
                                                                         SortOptions sortOptions)
        Sorts the elements in the list, set, or sorted set at key and stores the result in destination. The sort command can be used to sort elements based on different criteria, apply transformations on sorted elements, and store the result in a new key.
        To get the sort result without storing it into a key, see sort(String, SortOptions).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        sortOptions - The SortOptions.
        destination - The key where the sorted result will be stored.
        Returns:
        The number of elements in the sorted key stored at destination.
        See Also:
        valkey.io for details.
        Example:
        
         client.hset("user:1", Map.of("name", "Alice", "age", "30")).get();
         client.hset("user:2", Map.of("name", "Bob", "age", "25")).get();
         client.lpush("user_ids", new String[] {"2", "1"}).get();
         Long payload = client.sortStore("user_ids", "destination",
                  SortOptions.builder().byPattern("user:*->age").getPattern("user:*->name").build())
                  .get();
         assertEquals(2, payload);
         assertArrayEquals(
              new String[] {"Bob", "Alice"},
              client.lrange("destination", 0, -1).get()); // The list of the names sorted by age is stored in `destination`
         
      • sortStore

        java.util.concurrent.CompletableFuture<java.lang.Long> sortStore​(GlideString key,
                                                                         GlideString destination,
                                                                         SortOptionsBinary sortOptions)
        Sorts the elements in the list, set, or sorted set at key and stores the result in destination. The sort command can be used to sort elements based on different criteria, apply transformations on sorted elements, and store the result in a new key.
        To get the sort result without storing it into a key, see #sort(GlideString, SortOptions).
        Parameters:
        key - The key of the list, set, or sorted set to be sorted.
        sortOptions - The SortOptionsBinary.
        destination - The key where the sorted result will be stored.
        Returns:
        The number of elements in the sorted key stored at destination.
        See Also:
        valkey.io for details.
        Example:
        
         client.hset(gs("user:1"), Map.of(gs("name"), gs("Alice"), gs("age"), gs("30"))).get();
         client.hset(gs("user:2"), Map.of(gs("name"), gs("Bob"), gs("age"), gs("25"))).get();
         client.lpush(gs("user_ids"), new GlideString[] {gs("2"), gs("1")}).get();
         Long payload = client.sortStore(gs("user_ids"), gs("destination"),
                  SortOptionsBinary.builder().byPattern(gs("user:*->age")).getPattern(gs("user:*->name")).build())
                  .get();
         assertEquals(2, payload);
         assertArrayEquals(
              new GlideString[] {gs("Bob"), gs("Alice")},
              client.lrange(gs("destination"), 0, -1).get()); // The list of the names sorted by age is stored in `destination`
         
      • wait

        java.util.concurrent.CompletableFuture<java.lang.Long> wait​(long numreplicas,
                                                                    long timeout)
        Blocks the current client until all the previous write commands are successfully transferred and acknowledged by at least numreplicas of replicas. If timeout is reached, the command returns even if the specified number of replicas were not yet reached.
        Parameters:
        numreplicas - The number of replicas to reach.
        timeout - The timeout value specified in milliseconds. A value of 0 will block indefinitely.
        Returns:
        The number of replicas reached by all the writes performed in the context of the current connection.
        Example:
        
         client.set("key", "value).get();
         assert client.wait(1L, 1000L).get() == 1L;
         
      • waitaof

        java.util.concurrent.CompletableFuture<java.lang.Long[]> waitaof​(long numlocal,
                                                                         long numreplicas,
                                                                         long timeout)
        Blocks the current client until all previous write commands are successfully transferred and acknowledged by at least numlocal and numreplicas of replicas. If timeout is reached, the command returns even if the specified number of replicas were not yet reached.
        Parameters:
        numlocal - The number of local replicas to reach.
        numreplicas - The number of replicas to reach.
        timeout - The timeout value specified in milliseconds. A value of 0 will block indefinitely.
        Returns:
        An array of two Long values: the number of local replicas reached and the number of replicas reached.
        Since:
        Valkey 7.2 and above.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("key", "value").get();
         Long[] result = client.waitaof(1L, 1L, 1000L).get();
         assert result[0] >= 1L; // At least 1 local replica reached
         assert result[1] >= 1L; // At least 1 replica reached
         
      • migrate

        java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost,
                                                                         long destinationPort,
                                                                         java.lang.String key,
                                                                         long destinationDB,
                                                                         long timeout)
        Atomically transfers a key from a source Valkey instance to a destination Valkey instance. Once the key is successfully transferred, it is deleted from the source instance and is guaranteed to exist in the destination instance.
        Parameters:
        destinationHost - The destination host.
        destinationPort - The destination port.
        key - The key to migrate.
        destinationDB - The destination database index.
        timeout - The timeout in milliseconds.
        Returns:
        "OK" on success, or "NOKEY" if no keys were found in the source instance.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("key", "value").get();
         String result = client.migrate("destination.example.com", 6379, "key", 0, 5000).get();
         assert result.equals("OK");
         
      • migrate

        java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost,
                                                                         long destinationPort,
                                                                         GlideString key,
                                                                         long destinationDB,
                                                                         long timeout)
        Atomically transfers a key from a source Valkey instance to a destination Valkey instance. Once the key is successfully transferred, it is deleted from the source instance and is guaranteed to exist in the destination instance.

        Note: The host and port are String/long types because they represent network addresses, while the key can be GlideString to support binary-safe key names.

        Parameters:
        destinationHost - The destination host.
        destinationPort - The destination port.
        key - The key to migrate (binary-safe).
        destinationDB - The destination database index.
        timeout - The timeout in milliseconds.
        Returns:
        "OK" on success, or "NOKEY" if no keys were found in the source instance.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("key"), gs("value")).get();
         String result = client.migrate("destination.example.com", 6379, gs("key"), 0, 5000).get();
         assert result.equals("OK");
         
      • migrate

        java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost,
                                                                         long destinationPort,
                                                                         java.lang.String key,
                                                                         long destinationDB,
                                                                         long timeout,
                                                                         MigrateOptions migrateOptions)
        Atomically transfers a key from a source Valkey instance to a destination Valkey instance. Once the key is successfully transferred, it is deleted from the source instance (unless COPY is specified) and is guaranteed to exist in the destination instance.
        Parameters:
        destinationHost - The destination host.
        destinationPort - The destination port.
        key - The key to migrate.
        destinationDB - The destination database index.
        timeout - The timeout in milliseconds.
        migrateOptions - Additional options for the MIGRATE command.
        Returns:
        "OK" on success, or "NOKEY" if no keys were found in the source instance.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("key", "value").get();
         MigrateOptions options = MigrateOptions.builder().copy(true).replace(true).build();
         String result = client.migrate("destination.example.com", 6379, "key", 0, 5000, options).get();
         assert result.equals("OK");
         
      • migrate

        java.util.concurrent.CompletableFuture<java.lang.String> migrate​(java.lang.String destinationHost,
                                                                         long destinationPort,
                                                                         GlideString key,
                                                                         long destinationDB,
                                                                         long timeout,
                                                                         MigrateOptions migrateOptions)
        Atomically transfers a key from a source Valkey instance to a destination Valkey instance. Once the key is successfully transferred, it is deleted from the source instance (unless COPY is specified) and is guaranteed to exist in the destination instance.

        Note: The host and port are String/long types because they represent network addresses, while the key can be GlideString to support binary-safe key names.

        Parameters:
        destinationHost - The destination host.
        destinationPort - The destination port.
        key - The key to migrate (binary-safe).
        destinationDB - The destination database index.
        timeout - The timeout in milliseconds.
        migrateOptions - Additional options for the MIGRATE command.
        Returns:
        "OK" on success, or "NOKEY" if no keys were found in the source instance.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("key"), gs("value")).get();
         MigrateOptions options = MigrateOptions.builder().copy(true).replace(true).build();
         String result = client.migrate("destination.example.com", 6379, gs("key"), 0, 5000, options).get();
         assert result.equals("OK");