Package glide.api

Class GlideClusterClient

    • Constructor Detail

      • GlideClusterClient

        protected GlideClusterClient​(BaseClient.ClientBuilder builder)
        Constructor using ClientParams from BaseClient.
    • Method Detail

      • createClient

        public static java.util.concurrent.CompletableFuture<GlideClusterClient> createClient​(@NonNull
                                                                                              @NonNull GlideClusterClientConfiguration config)
        Creates a new GlideClusterClient instance and establishes connections to a Valkey Cluster.
        Parameters:
        config - The configuration options for the client, including cluster addresses, authentication credentials, TLS settings, periodic checks, and Pub/Sub subscriptions.
        Returns:
        A Future that resolves to a connected GlideClusterClient instance.
        Example:
        
         GlideClusterClientConfiguration config =
             GlideClusterClientConfiguration.builder()
                 .address(node1address)
                 .address(node2address)
                 .useTLS(true)
                 .readFrom(ReadFrom.PREFER_REPLICA)
                 .credentials(credentialsConfiguration)
                 .requestTimeout(2000)
                 .clientName("GLIDE")
                 .subscriptionConfiguration(
                     ClusterSubscriptionConfiguration.builder()
                         .subscription(EXACT, "notifications")
                         .subscription(EXACT, "news")
                         .subscription(SHARDED, "data")
                         .callback(callback)
                         .build())
                 .inflightRequestsLimit(1000)
                 .build();
         GlideClusterClient client = GlideClusterClient.createClient(config).get();
         
      • customCommand

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object>> customCommand​(@NonNull
                                                                                                    @NonNull java.lang.String[] args)
        Description copied from interface: GenericClusterCommands
        Executes a single command, without checking inputs. Every part of the command, including subcommands, should be added as a separate value in args.
        The command will be routed automatically based on the passed command's default request policy.
        Specified by:
        customCommand in interface GenericClusterCommands
        Parameters:
        args - Arguments for the custom command including the command name.
        Returns:
        The returned value for the custom command.
        See Also:
        Valkey GLIDE Wiki for details on the restrictions and limitations of the custom command API.
      • customCommand

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object>> customCommand​(@NonNull
                                                                                                    @NonNull GlideString[] args)
        Description copied from interface: GenericClusterCommands
        Executes a single command, without checking inputs. Every part of the command, including subcommands, should be added as a separate value in args.
        The command will be routed automatically based on the passed command's default request policy.
        Specified by:
        customCommand in interface GenericClusterCommands
        Parameters:
        args - Arguments for the custom command including the command name.
        Returns:
        The returned value for the custom command.
        See Also:
        Valkey GLIDE Wiki for details on the restrictions and limitations of the custom command API.
      • customCommand

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object>> customCommand​(@NonNull
                                                                                                    @NonNull java.lang.String[] args,
                                                                                                    @NonNull
                                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: GenericClusterCommands
        Executes a single command, without checking inputs. Every part of the command, including subcommands, should be added as a separate value in args.
        Specified by:
        customCommand in interface GenericClusterCommands
        Parameters:
        args - Arguments for the custom command including the command name
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The returning value depends on the executed command and route.
        See Also:
        Valkey GLIDE Wiki for details on the restrictions and limitations of the custom command API.
      • customCommand

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object>> customCommand​(@NonNull
                                                                                                    @NonNull GlideString[] args,
                                                                                                    @NonNull
                                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: GenericClusterCommands
        Executes a single command, without checking inputs. Every part of the command, including subcommands, should be added as a separate value in args.
        Specified by:
        customCommand in interface GenericClusterCommands
        Parameters:
        args - Arguments for the custom command including the command name
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The returning value depends on the executed command and route.
        See Also:
        Valkey GLIDE Wiki for details on the restrictions and limitations of the custom command API.
      • exec

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> exec​(@NonNull
                                                                               @NonNull ClusterBatch batch,
                                                                               boolean raiseOnError)
        Description copied from interface: TransactionsClusterCommands
        Executes a batch by processing the queued commands.

        Routing Behavior:

        • For atomic batches (Transactions):
          • The transaction will be routed to the slot owner of the first key found in the batch.
          • If no key is found, the request will be sent to a random node.
        • For non-atomic batches:
          • Each command will be routed to the node that owns the corresponding key's slot. If no key is present, the routing will follow the default policy for the command.
          • Multi-node commands will be automatically split and sent to the respective nodes.

        Notes:

        • Atomic Batches (Transactions): All key-based commands must map to the same hash slot. If keys span different slots, the transaction will fail. If the transaction fails due to a WATCH command, EXEC will return null.
        Specified by:
        exec in interface TransactionsClusterCommands
        Parameters:
        batch - A ClusterBatch object containing a list of commands to be executed.
        raiseOnError - Determines how errors are handled within the batch response.

        When set to true, the first encountered error in the batch will be raised as an exception of type RequestException after all retries and reconnections have been executed.

        When set to false, errors will be included as part of the batch response, allowing the caller to process both successful and failed commands together. In this case, error details will be provided as instances of RequestException.

        Returns:
        A CompletableFuture resolving to an array of results, where each entry corresponds to a command’s execution result.
        See Also:
        Valkey Transactions (Atomic Batches), Valkey Pipelines (Non-Atomic Batches)
      • exec

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> exec​(@NonNull
                                                                               @NonNull ClusterBatch batch,
                                                                               boolean raiseOnError,
                                                                               @NonNull
                                                                               @NonNull ClusterBatchOptions options)
        Description copied from interface: TransactionsClusterCommands
        Executes a batch by processing the queued commands.

        Routing Behavior:

        • If a route is specified in ClusterBatchOptions, the entire batch is sent to the specified node.
        • If no route is specified:
          • Atomic batches (Transactions): Routed to the slot owner of the first key in the batch. If no key is found, the request is sent to a random node.
          • Non-atomic batches (Pipelines): Each command is routed to the node owning the corresponding key's slot. If no key is present, routing follows the command's request policy. Multi-node commands are automatically split and dispatched to the appropriate nodes.

        Behavior notes:

        • Atomic Batches (Transactions): All key-based commands must map to the same hash slot. If keys span different slots, the transaction will fail. If the transaction fails due to a WATCH command, EXEC will return null.

        Retry and Redirection:

        • If a redirection error occurs:
          • Atomic batches (Transactions): The entire transaction will be redirected.
          • Non-atomic batches: Only commands that encountered redirection errors will be redirected.
        • Retries for failures will be handled according to the configured ClusterBatchRetryStrategy.
        Specified by:
        exec in interface TransactionsClusterCommands
        Parameters:
        batch - A ClusterBatch containing the commands to execute.
        raiseOnError - Determines how errors are handled within the batch response.

        When set to true, the first encountered error in the batch will be raised as an exception of type RequestException after all retries and reconnections have been executed.

        When set to false, errors will be included as part of the batch response, allowing the caller to process both successful and failed commands together. In this case, error details will be provided as instances of RequestException.

        options - A ClusterBatchOptions object containing execution options.
        Returns:
        A CompletableFuture resolving to an array of results, where each entry corresponds to a command’s execution result.
        See Also:
        Valkey Transactions (Atomic Batches), Valkey Pipelines (Non-Atomic Batches)
      • ping

        public java.util.concurrent.CompletableFuture<java.lang.String> ping​(@NonNull
                                                                             @NonNull java.lang.String message)
        Description copied from interface: ConnectionManagementClusterCommands
        Pings the server.
        The command will be routed to all primary nodes.
        Specified by:
        ping in interface ConnectionManagementClusterCommands
        Parameters:
        message - The server will respond with a copy of the message.
        Returns:
        String with a copy of the argument message.
        See Also:
        valkey.io for details.
      • ping

        public java.util.concurrent.CompletableFuture<java.lang.String> ping​(@NonNull
                                                                             @NonNull java.lang.String message,
                                                                             @NonNull
                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ConnectionManagementClusterCommands
        Pings the server.
        Specified by:
        ping in interface ConnectionManagementClusterCommands
        Parameters:
        message - The ping argument that will be returned.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        String with a copy of the argument message.
        See Also:
        valkey.io for details.
      • info

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info​(@NonNull
                                                                                           @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Gets information and statistics about the server. If no argument is provided, so the InfoOptions.Section.DEFAULT option is assumed.
        Specified by:
        info in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A String containing the information for the default sections. When specifying a route other than a single node, it returns a Map<String, String> with each address as the key and its corresponding value is the information for the node.
        See Also:
        valkey.io for details.
      • info

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info​(@NonNull
                                                                                           @NonNull InfoOptions.Section[] sections)
        Description copied from interface: ServerManagementClusterCommands
        Gets information and statistics about the server.
        Starting from server version 7, command supports multiple section arguments.
        The command will be routed to all primary nodes.
        Specified by:
        info in interface ServerManagementClusterCommands
        Parameters:
        sections - A list of InfoOptions.Section values specifying which sections of information to retrieve. When no parameter is provided, the InfoOptions.Section.DEFAULT option is assumed.
        Returns:
        A Map<String, String> with each address as the key and its corresponding value is the information of the sections requested for the node.
        See Also:
        valkey.io for details.
      • clientPause

        public java.util.concurrent.CompletableFuture<java.lang.String> clientPause​(long timeout)
        Description copied from interface: ConnectionManagementClusterCommands
        Suspends all clients for the specified timeout.
        The command will be routed to all primary nodes.
        Specified by:
        clientPause in interface ConnectionManagementClusterCommands
        Parameters:
        timeout - The time in milliseconds to pause clients.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • clientPause

        public java.util.concurrent.CompletableFuture<java.lang.String> clientPause​(long timeout,
                                                                                    @NonNull
                                                                                    @NonNull ClientPauseMode mode)
        Description copied from interface: ConnectionManagementClusterCommands
        Suspends all clients for the specified timeout.
        The command will be routed to all primary nodes.
        Specified by:
        clientPause in interface ConnectionManagementClusterCommands
        Parameters:
        timeout - The time in milliseconds to pause clients.
        mode - The pause mode to use.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • clientPause

        public java.util.concurrent.CompletableFuture<java.lang.String> clientPause​(long timeout,
                                                                                    @NonNull
                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ConnectionManagementClusterCommands
        Suspends all clients for the specified timeout.
        The command will be routed to the nodes defined by route.
        Specified by:
        clientPause in interface ConnectionManagementClusterCommands
        Parameters:
        timeout - The time in milliseconds to pause clients.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • clientPause

        public java.util.concurrent.CompletableFuture<java.lang.String> clientPause​(long timeout,
                                                                                    @NonNull
                                                                                    @NonNull ClientPauseMode mode,
                                                                                    @NonNull
                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ConnectionManagementClusterCommands
        Suspends all clients for the specified timeout.
        The command will be routed to the nodes defined by route.
        Specified by:
        clientPause in interface ConnectionManagementClusterCommands
        Parameters:
        timeout - The time in milliseconds to pause clients.
        mode - The pause mode to use.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • info

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info​(@NonNull
                                                                                           @NonNull InfoOptions.Section[] sections,
                                                                                           @NonNull
                                                                                           @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Gets information and statistics about the server.
        Starting from server version 7, command supports multiple section arguments.
        Specified by:
        info in interface ServerManagementClusterCommands
        Parameters:
        sections - A list of InfoOptions.Section values specifying which sections of information to retrieve. When no parameter is provided, the InfoOptions.Section.DEFAULT option is assumed.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A String with the containing the information for the sections requested. When specifying a route other than a single node, it returns a Map<String, String> with each address as the key and its corresponding value is the information of the sections requested for the node.
        See Also:
        valkey.io for details.
      • clientId

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Long>> clientId​(@NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ConnectionManagementClusterCommands
        Gets the current connection id.
        Specified by:
        clientId in interface ConnectionManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A ClusterValue which holds a single value if single node route is used or a dictionary where each address is the key and its corresponding node response is the value. The value is the id of the client on that node.
        See Also:
        valkey.io for details.
      • clientGetName

        public java.util.concurrent.CompletableFuture<java.lang.String> clientGetName()
        Description copied from interface: ConnectionManagementClusterCommands
        Gets the name of the current connection.
        The command will be routed a random node.
        Specified by:
        clientGetName in interface ConnectionManagementClusterCommands
        Returns:
        The name of the client connection as a string if a name is set, or null if no name is assigned.
        See Also:
        valkey.io for details.
      • clientGetName

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clientGetName​(@NonNull
                                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ConnectionManagementClusterCommands
        Gets the name of the current connection.
        Specified by:
        clientGetName in interface ConnectionManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A ClusterValue which holds a single value if single node route is used or a dictionary where each address is the key and its corresponding node response is the value. The value is the name of the client connection as a string if a name is set, or null if no name is assigned.
        See Also:
        valkey.io for details.
      • clientTrackingInfo

        public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>> clientTrackingInfo()
        Description copied from interface: ConnectionManagementClusterCommands
        Returns information about the current client connection's use of the server assisted client side caching feature.

        Routes to a random node by default. To specify routing, use ConnectionManagementClusterCommands.clientTrackingInfo(Route).

        Specified by:
        clientTrackingInfo in interface ConnectionManagementClusterCommands
        Returns:
        A Map with the client's tracking state. The map contains:
        • flags: a Set of tracking flags. See valkey.io for the full list.
        • redirect: a Long with the client ID receiving invalidation messages, or -1 if not redirecting
        • prefixes: an Object[] of key prefixes monitored for invalidation
        See Also:
        valkey.io for details.
      • clientTrackingInfo

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.lang.Object>>> clientTrackingInfo​(@NonNull
                                                                                                                                               @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ConnectionManagementClusterCommands
        Returns information about the current client connection's use of the server assisted client side caching feature.
        Specified by:
        clientTrackingInfo in interface ConnectionManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command.
        Returns:
        A ClusterValue containing the tracking state map per the routing.
        • For a RequestRoutingConfiguration.SingleNodeRoute: a single Map where:
          • flags: a Set of tracking flags. See valkey.io for the full list.
          • redirect: a Long with the client ID receiving invalidation messages, or -1 if not redirecting
          • prefixes: an Object[] of key prefixes monitored for invalidation
        • For a multi-node route: a Map of node address to tracking state map.
        See Also:
        valkey.io for details.
      • configRewrite

        public java.util.concurrent.CompletableFuture<java.lang.String> configRewrite()
        Description copied from interface: ServerManagementClusterCommands
        Rewrites the configuration file with the current configuration.
        The command will be routed automatically to all nodes.
        Specified by:
        configRewrite in interface ServerManagementClusterCommands
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • configGet

        public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.String>> configGet​(@NonNull
                                                                                                                        @NonNull java.lang.String[] parameters)
        Description copied from interface: ServerManagementClusterCommands
        Get the values of configuration parameters.
        Starting from server version 7, command supports multiple parameters.
        The command will be sent to a random node.
        Specified by:
        configGet in interface ServerManagementClusterCommands
        Parameters:
        parameters - An array of configuration parameter names to retrieve values for.
        Returns:
        A map of values corresponding to the configuration parameters.
        See Also:
        valkey.io for details.
      • configGet

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.lang.String>>> configGet​(@NonNull
                                                                                                                                      @NonNull java.lang.String[] parameters,
                                                                                                                                      @NonNull
                                                                                                                                      @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Get the values of configuration parameters.
        Starting from server version 7, command supports multiple parameters.
        Specified by:
        configGet in interface ServerManagementClusterCommands
        Parameters:
        parameters - An array of configuration parameter names to retrieve values for.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A map of values corresponding to the configuration parameters.
        When specifying a route other than a single node, it returns a dictionary where each address is the key and its corresponding node response is the value.
        See Also:
        valkey.io for details.
      • configSet

        public java.util.concurrent.CompletableFuture<java.lang.String> configSet​(@NonNull
                                                                                  @NonNull java.util.Map<java.lang.String,​java.lang.String> parameters)
        Description copied from interface: ServerManagementClusterCommands
        Sets configuration parameters to the specified values.
        Starting from server version 7, command supports multiple parameters.
        The command will be sent to all nodes.
        Specified by:
        configSet in interface ServerManagementClusterCommands
        Parameters:
        parameters - A map consisting of configuration parameters and their respective values to set.
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • configSet

        public java.util.concurrent.CompletableFuture<java.lang.String> configSet​(@NonNull
                                                                                  @NonNull java.util.Map<java.lang.String,​java.lang.String> parameters,
                                                                                  @NonNull
                                                                                  @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Sets configuration parameters to the specified values.
        Starting from server version 7, command supports multiple parameters.
        Specified by:
        configSet in interface ServerManagementClusterCommands
        Parameters:
        parameters - A map consisting of configuration parameters and their respective values to set.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • echo

        public java.util.concurrent.CompletableFuture<java.lang.String> echo​(@NonNull
                                                                             @NonNull java.lang.String message)
        Description copied from interface: ConnectionManagementClusterCommands
        Echoes the provided message back.
        The command will be routed a random node.
        Specified by:
        echo in interface ConnectionManagementClusterCommands
        Parameters:
        message - The message to be echoed back.
        Returns:
        The provided message.
        See Also:
        valkey.io for details.
      • time

        public java.util.concurrent.CompletableFuture<java.lang.String[]> time()
        Description copied from interface: ServerManagementClusterCommands
        Returns the server time.
        The command will be routed to a random node.
        Specified by:
        time in interface ServerManagementClusterCommands
        Returns:
        The current server time as a String array with two elements: A UNIX TIME and the amount of microseconds already elapsed in the current second. The returned array is in a [UNIX TIME, Microseconds already elapsed] format.
        See Also:
        valkey.io for details.
      • time

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String[]>> time​(@NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Returns the server time.
        Specified by:
        time in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The current server time as a String array with two elements: A UNIX TIME and the amount of microseconds already elapsed in the current second. The returned array is in a [UNIX TIME, Microseconds already elapsed] format.
        See Also:
        valkey.io for details.
      • lastsave

        public java.util.concurrent.CompletableFuture<java.lang.Long> lastsave()
        Description copied from interface: ServerManagementClusterCommands
        Returns UNIX TIME of the last DB save timestamp or startup timestamp if no save was made since then.
        The command will be routed to a random node.
        Specified by:
        lastsave in interface ServerManagementClusterCommands
        Returns:
        UNIX TIME of the last DB save executed with success.
        See Also:
        valkey.io for details.
      • lastsave

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Long>> lastsave​(@NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Returns UNIX TIME of the last DB save timestamp or startup timestamp if no save was made since then.
        Specified by:
        lastsave in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        UNIX TIME of the last DB save executed with success.
        See Also:
        valkey.io for details.
      • latencyHistory

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyHistory​(@NonNull
                                                                                                         @NonNull java.lang.String event)
        Description copied from interface: ServerManagementClusterCommands
        Returns the latency spike time series for the specified event.
        The command will be routed to all primary nodes.
        Specified by:
        latencyHistory in interface ServerManagementClusterCommands
        Parameters:
        event - The name of the latency event (e.g., "command").
        Returns:
        A cluster value containing array(s) of arrays representing latency spike entries, or an empty array if the event doesn't exist.
        See Also:
        valkey.io for details.
      • latencyHistory

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyHistory​(@NonNull
                                                                                                         @NonNull java.lang.String event,
                                                                                                         @NonNull
                                                                                                         @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Returns the latency spike time series for the specified event.
        Specified by:
        latencyHistory in interface ServerManagementClusterCommands
        Parameters:
        event - The name of the latency event (e.g., "command").
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A cluster value containing array(s) of arrays representing latency spike entries, or an empty array if the event doesn't exist.
        See Also:
        valkey.io for details.
      • latencyLatest

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyLatest()
        Description copied from interface: ServerManagementClusterCommands
        Reports the latest latency events logged by the server.
        The command will be routed to all primary nodes.
        Specified by:
        latencyLatest in interface ServerManagementClusterCommands
        Returns:
        A cluster value containing array(s) of arrays representing latency event info.
        See Also:
        valkey.io for details.
      • latencyReset

        public java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset()
        Description copied from interface: ServerManagementClusterCommands
        Resets the latency spike time series for all events.
        The command will be routed to all primary nodes.
        Specified by:
        latencyReset in interface ServerManagementClusterCommands
        Returns:
        The total number of event time series that were reset across all nodes.
        See Also:
        valkey.io for details.
      • latencyReset

        public java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset​(@NonNull
                                                                                   @NonNull java.lang.String[] events)
        Description copied from interface: ServerManagementClusterCommands
        Resets the latency spike time series for the specified events.
        If events is empty, resets the latency spike time series for all events.
        The command will be routed to all primary nodes.
        Specified by:
        latencyReset in interface ServerManagementClusterCommands
        Parameters:
        events - The event names to reset.
        Returns:
        The total number of event time series that were reset across all nodes.
        See Also:
        valkey.io for details.
      • latencyReset

        public java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset​(@NonNull
                                                                                   @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Resets the latency spike time series for all events.
        Specified by:
        latencyReset in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The total number of event time series that were reset.
        See Also:
        valkey.io for details.
      • latencyReset

        public java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset​(@NonNull
                                                                                   @NonNull java.lang.String[] events,
                                                                                   @NonNull
                                                                                   @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Resets the latency spike time series for the specified events.
        If events is empty, resets the latency spike time series for all events.
        Specified by:
        latencyReset in interface ServerManagementClusterCommands
        Parameters:
        events - The event names to reset.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The total number of event time series that were reset.
        See Also:
        valkey.io for details.
      • memoryDoctor

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> memoryDoctor()
        Description copied from interface: ServerManagementClusterCommands
        Returns a report about memory problems detected by the server.
        The command will be routed to all primary nodes by default.
        Specified by:
        memoryDoctor in interface ServerManagementClusterCommands
        Returns:
        A cluster value containing the memory diagnostic report(s).
        See Also:
        valkey.io for details.
      • memoryPurge

        public java.util.concurrent.CompletableFuture<java.lang.String> memoryPurge()
        Description copied from interface: ServerManagementClusterCommands
        Asks the server to reclaim memory from the allocator back to the operating system.
        The command will be routed to all primary nodes by default.
        Specified by:
        memoryPurge in interface ServerManagementClusterCommands
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • memoryPurge

        public java.util.concurrent.CompletableFuture<java.lang.String> memoryPurge​(@NonNull
                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Asks the server to reclaim memory from the allocator back to the operating system.
        Specified by:
        memoryPurge in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • memoryStats

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.lang.Object>>> memoryStats()
        Description copied from interface: ServerManagementClusterCommands
        Returns detailed memory consumption statistics of the server.
        The command will be routed to all primary nodes by default.
        Specified by:
        memoryStats in interface ServerManagementClusterCommands
        Returns:
        A cluster value containing a map of memory statistics.
        See Also:
        valkey.io for details.
      • memoryStats

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.lang.Object>>> memoryStats​(@NonNull
                                                                                                                                        @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Returns detailed memory consumption statistics of the server.
        Specified by:
        memoryStats in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A cluster value containing a map of memory statistics.
        See Also:
        valkey.io for details.
      • save

        public java.util.concurrent.CompletableFuture<java.lang.String> save​(@NonNull
                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Synchronously saves the dataset to disk.
        The command will be routed to the nodes defined by route.
        Specified by:
        save in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • bgsave

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsave​(@NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Asynchronously saves the dataset to disk in the background.
        The command will be routed to the nodes defined by route.
        Specified by:
        bgsave in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A ClusterValue<String> containing status strings.
        See Also:
        valkey.io for details.
      • bgsaveSchedule

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsaveSchedule​(@NonNull
                                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Schedules a background save of the database.
        The command will be routed to the nodes defined by route.
        Specified by:
        bgsaveSchedule in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A ClusterValue<String> containing status strings.
        See Also:
        valkey.io for details.
      • bgsaveCancel

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsaveCancel​(@NonNull
                                                                                                   @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Aborts all in-progress and scheduled background saves.
        The command will be routed to the nodes defined by route.
        Specified by:
        bgsaveCancel in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A ClusterValue<String> containing status strings.
        See Also:
        valkey.io for details.
      • bgrewriteaof

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgrewriteaof​(@NonNull
                                                                                                   @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Initiates a background rewrite of the append-only file (AOF).
        The command will be routed to the nodes defined by route.
        Specified by:
        bgrewriteaof in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A ClusterValue<String> containing status strings.
        See Also:
        valkey.io for details.
      • flushall

        public java.util.concurrent.CompletableFuture<java.lang.String> flushall()
        Description copied from interface: ServerManagementClusterCommands
        Deletes all the keys of all the existing databases. This command never fails.
        The command will be routed to all primary nodes.
        Specified by:
        flushall in interface ServerManagementClusterCommands
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • flushall

        public java.util.concurrent.CompletableFuture<java.lang.String> flushall​(@NonNull
                                                                                 @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Deletes all the keys of all the existing databases. This command never fails.
        Specified by:
        flushall in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • flushdb

        public java.util.concurrent.CompletableFuture<java.lang.String> flushdb()
        Description copied from interface: ServerManagementClusterCommands
        Deletes all the keys of the currently selected database. This command never fails.
        The command will be routed to all primary nodes.
        Specified by:
        flushdb in interface ServerManagementClusterCommands
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • flushdb

        public java.util.concurrent.CompletableFuture<java.lang.String> flushdb​(@NonNull
                                                                                @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Deletes all the keys of the currently selected database. This command never fails.
        Specified by:
        flushdb in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        "OK" response on success.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<java.lang.String> lolwut()
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        The command will be routed to a random node.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<java.lang.String> lolwut​(int @NonNull [] parameters)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        The command will be routed to a random node.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        parameters - Additional set of arguments in order to change the output:
        • On Valkey version 5, those are length of the line, number of squares per row, and number of squares per column.
        • On Valkey version 6, those are number of columns and number of lines.
        • On other versions parameters are ignored.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<java.lang.String> lolwut​(int version)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        The command will be routed to a random node.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        version - Version of computer art to generate.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<java.lang.String> lolwut​(int version,
                                                                               int @NonNull [] parameters)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        The command will be routed to a random node.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        version - Version of computer art to generate.
        parameters - Additional set of arguments in order to change the output:
        • For version 5, those are length of the line, number of squares per row, and number of squares per column.
        • For version 6, those are number of columns and number of lines.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut​(@NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut​(int @NonNull [] parameters,
                                                                                             @NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        parameters - Additional set of arguments in order to change the output:
        • On Valkey version 5, those are length of the line, number of squares per row, and number of squares per column.
        • On Valkey version 6, those are number of columns and number of lines.
        • On other versions parameters are ignored.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut​(int version,
                                                                                             @NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        version - Version of computer art to generate.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • lolwut

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut​(int version,
                                                                                             int @NonNull [] parameters,
                                                                                             @NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Displays a piece of generative computer art and the Valkey version.
        Specified by:
        lolwut in interface ServerManagementClusterCommands
        Parameters:
        version - Version of computer art to generate.
        parameters - Additional set of arguments in order to change the output:
        • For version 5, those are length of the line, number of squares per row, and number of squares per column.
        • For version 6, those are number of columns and number of lines.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A piece of generative computer art along with the current Valkey version.
        See Also:
        valkey.io for details.
      • dbsize

        public java.util.concurrent.CompletableFuture<java.lang.Long> dbsize()
        Description copied from interface: ServerManagementClusterCommands
        Returns the number of keys in the database.
        The command will be routed to all primary nodes.
        Specified by:
        dbsize in interface ServerManagementClusterCommands
        Returns:
        The total number of keys across the primary nodes.
        See Also:
        valkey.io for details.
      • dbsize

        public java.util.concurrent.CompletableFuture<java.lang.Long> dbsize​(@NonNull
                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        Returns the number of keys in the database.
        Specified by:
        dbsize in interface ServerManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The number of keys in the database.
        If the query is routed to multiple nodes, returns the sum of the number of keys across all routed nodes.
        See Also:
        valkey.io for details.
      • functionLoad

        public java.util.concurrent.CompletableFuture<java.lang.String> functionLoad​(@NonNull
                                                                                     @NonNull java.lang.String libraryCode,
                                                                                     boolean replace)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Loads a library to Valkey.
        The command will be routed to all primary nodes.
        Specified by:
        functionLoad in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libraryCode - The source code that implements the library.
        replace - Whether the given library should overwrite a library with the same name if it already exists.
        Returns:
        The library name that was loaded.
        See Also:
        valkey.io for details.
      • functionLoad

        public java.util.concurrent.CompletableFuture<GlideString> functionLoad​(@NonNull
                                                                                @NonNull GlideString libraryCode,
                                                                                boolean replace)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Loads a library to Valkey.
        The command will be routed to all primary nodes.
        Specified by:
        functionLoad in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libraryCode - The source code that implements the library.
        replace - Whether the given library should overwrite a library with the same name if it already exists.
        Returns:
        The library name that was loaded.
        See Also:
        valkey.io for details.
      • functionLoad

        public java.util.concurrent.CompletableFuture<java.lang.String> functionLoad​(@NonNull
                                                                                     @NonNull java.lang.String libraryCode,
                                                                                     boolean replace,
                                                                                     @NonNull
                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Loads a library to Valkey.
        Specified by:
        functionLoad in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libraryCode - The source code that implements the library.
        replace - Whether the given library should overwrite a library with the same name if it already exists.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The library name that was loaded.
        See Also:
        valkey.io for details.
      • functionLoad

        public java.util.concurrent.CompletableFuture<GlideString> functionLoad​(@NonNull
                                                                                @NonNull GlideString libraryCode,
                                                                                boolean replace,
                                                                                @NonNull
                                                                                @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Loads a library to Valkey.
        Specified by:
        functionLoad in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libraryCode - The source code that implements the library.
        replace - Whether the given library should overwrite a library with the same name if it already exists.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The library name that was loaded.
        See Also:
        valkey.io for details.
      • functionList

        public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>[]> functionList​(boolean withCode)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        The command will be routed to a random node.
        Specified by:
        functionList in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        withCode - Specifies whether to request the library code from the server or not.
        Returns:
        Info about all libraries and their functions.
        See Also:
        valkey.io for details.
      • functionListBinary

        public java.util.concurrent.CompletableFuture<java.util.Map<GlideString,​java.lang.Object>[]> functionListBinary​(boolean withCode)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        The command will be routed to a random node.
        Specified by:
        functionListBinary in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        withCode - Specifies whether to request the library code from the server or not.
        Returns:
        Info about all libraries and their functions.
        See Also:
        valkey.io for details.
      • functionList

        public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>[]> functionList​(@NonNull
                                                                                                                             @NonNull java.lang.String libNamePattern,
                                                                                                                             boolean withCode)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        The command will be routed to a random node.
        Specified by:
        functionList in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libNamePattern - A wildcard pattern for matching library names.
        withCode - Specifies whether to request the library code from the server or not.
        Returns:
        Info about queried libraries and their functions.
        See Also:
        valkey.io for details.
      • functionListBinary

        public java.util.concurrent.CompletableFuture<java.util.Map<GlideString,​java.lang.Object>[]> functionListBinary​(@NonNull
                                                                                                                              @NonNull GlideString libNamePattern,
                                                                                                                              boolean withCode)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        The command will be routed to a random node.
        Specified by:
        functionListBinary in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libNamePattern - A wildcard pattern for matching library names.
        withCode - Specifies whether to request the library code from the server or not.
        Returns:
        Info about queried libraries and their functions.
        See Also:
        valkey.io for details.
      • functionList

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.lang.Object>[]>> functionList​(boolean withCode,
                                                                                                                                           @NonNull
                                                                                                                                           @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        Specified by:
        functionList in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        withCode - Specifies whether to request the library code from the server or not.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        Info about all libraries and their functions.
        See Also:
        valkey.io for details.
      • functionList

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.lang.Object>[]>> functionList​(@NonNull
                                                                                                                                           @NonNull java.lang.String libNamePattern,
                                                                                                                                           boolean withCode,
                                                                                                                                           @NonNull
                                                                                                                                           @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        Specified by:
        functionList in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libNamePattern - A wildcard pattern for matching library names.
        withCode - Specifies whether to request the library code from the server or not.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        Info about queried libraries and their functions.
        See Also:
        valkey.io for details.
      • functionListBinary

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<GlideString,​java.lang.Object>[]>> functionListBinary​(@NonNull
                                                                                                                                            @NonNull GlideString libNamePattern,
                                                                                                                                            boolean withCode,
                                                                                                                                            @NonNull
                                                                                                                                            @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the functions and libraries.
        Specified by:
        functionListBinary in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libNamePattern - A wildcard pattern for matching library names.
        withCode - Specifies whether to request the library code from the server or not.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        Info about queried libraries and their functions.
        See Also:
        valkey.io for details.
      • functionDelete

        public java.util.concurrent.CompletableFuture<java.lang.String> functionDelete​(@NonNull
                                                                                       @NonNull java.lang.String libName)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Deletes a library and all its functions.
        The command will be routed to all primary nodes.
        Specified by:
        functionDelete in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        libName - The library name to delete.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • fcall

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object>> fcall​(@NonNull
                                                                                            @NonNull java.lang.String function,
                                                                                            @NonNull
                                                                                            @NonNull java.lang.String[] arguments,
                                                                                            @NonNull
                                                                                            @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a previously loaded function.
        Specified by:
        fcall in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        function - The function name.
        arguments - An array of function arguments. arguments should not represent names of keys.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The invoked function's return value wrapped by a ClusterValue.
        See Also:
        valkey.io for details.
      • fcallReadOnly

        public java.util.concurrent.CompletableFuture<java.lang.Object> fcallReadOnly​(@NonNull
                                                                                      @NonNull java.lang.String function)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a previously loaded read-only function.
        The command is routed to a random node depending on the client's ReadFrom strategy.
        Specified by:
        fcallReadOnly in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        function - The function name.
        Returns:
        The invoked function's return value.
        See Also:
        valkey.io for details.
      • fcallReadOnly

        public java.util.concurrent.CompletableFuture<java.lang.Object> fcallReadOnly​(@NonNull
                                                                                      @NonNull java.lang.String function,
                                                                                      @NonNull
                                                                                      @NonNull java.lang.String[] arguments)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a previously loaded function.
        The command is routed to a random node depending on the client's ReadFrom strategy.
        Specified by:
        fcallReadOnly in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        function - The function name.
        arguments - An array of function arguments. arguments should not represent names of keys.
        Returns:
        The invoked function's return value.
        See Also:
        valkey.io for details.
      • fcallReadOnly

        public java.util.concurrent.CompletableFuture<java.lang.Object> fcallReadOnly​(@NonNull
                                                                                      @NonNull GlideString function,
                                                                                      @NonNull
                                                                                      @NonNull GlideString[] arguments)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a previously loaded function.
        The command is routed to a random node depending on the client's ReadFrom strategy.
        Specified by:
        fcallReadOnly in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        function - The function name.
        arguments - An array of function arguments. arguments should not represent names of keys.
        Returns:
        The invoked function's return value.
        See Also:
        valkey.io for details.
      • fcallReadOnly

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object>> fcallReadOnly​(@NonNull
                                                                                                    @NonNull java.lang.String function,
                                                                                                    @NonNull
                                                                                                    @NonNull java.lang.String[] arguments,
                                                                                                    @NonNull
                                                                                                    @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a previously loaded read-only function.
        Specified by:
        fcallReadOnly in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        function - The function name.
        arguments - An array of function arguments. arguments should not represent names of keys.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The invoked function's return value wrapped by a ClusterValue.
        See Also:
        valkey.io for details.
      • functionKill

        public java.util.concurrent.CompletableFuture<java.lang.String> functionKill()
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Kills a function that is currently executing.
        FUNCTION KILL terminates read-only functions only.
        The command will be routed to all nodes.
        Specified by:
        functionKill in interface ScriptingAndFunctionsClusterCommands
        Returns:
        OK if function is terminated. Otherwise, throws an error.
        See Also:
        valkey.io for details.
      • functionKill

        public java.util.concurrent.CompletableFuture<java.lang.String> functionKill​(@NonNull
                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Kills a function that is currently executing.
        FUNCTION KILL terminates read-only functions only.
        Specified by:
        functionKill in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        OK if function is terminated. Otherwise, throws an error.
        See Also:
        valkey.io for details.
      • invokeScript

        public java.util.concurrent.CompletableFuture<java.lang.Object> invokeScript​(@NonNull
                                                                                     @NonNull Script script,
                                                                                     @NonNull
                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a Lua script.
        This method simplifies the process of invoking scripts on the server by using an object that represents a Lua script. The script loading and execution will all be handled internally. If the script has not already been loaded, it will be loaded automatically using the SCRIPT LOAD command. After that, it will be invoked using the EVALSHA command.
        Specified by:
        invokeScript in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        script - The Lua script to execute.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A value that depends on the script that was executed.
        See Also:
        SCRIPT LOAD and EVALSHA for details.
      • invokeScript

        public java.util.concurrent.CompletableFuture<java.lang.Object> invokeScript​(@NonNull
                                                                                     @NonNull Script script,
                                                                                     @NonNull
                                                                                     @NonNull ScriptArgOptions options,
                                                                                     @NonNull
                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a Lua script with its keys and arguments.
        This method simplifies the process of invoking scripts on the server by using an object that represents a Lua script. The script loading, argument preparation, and execution will all be handled internally. If the script has not already been loaded, it will be loaded automatically using the SCRIPT LOAD command. After that, it will be invoked using the EVALSHA command.
        Specified by:
        invokeScript in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        script - The Lua script to execute.
        options - The script option that contains the non-key arguments for the script.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A value that depends on the script that was executed.
        See Also:
        SCRIPT LOAD and EVALSHA for details.
      • invokeScript

        public java.util.concurrent.CompletableFuture<java.lang.Object> invokeScript​(@NonNull
                                                                                     @NonNull Script script,
                                                                                     @NonNull
                                                                                     @NonNull ScriptArgOptionsGlideString options,
                                                                                     @NonNull
                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Invokes a Lua script with its keys and arguments.
        This method simplifies the process of invoking scripts on the server by using an object that represents a Lua script. The script loading, argument preparation, and execution will all be handled internally. If the script has not already been loaded, it will be loaded automatically using the SCRIPT LOAD command. After that, it will be invoked using the EVALSHA command.
        Specified by:
        invokeScript in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        script - The Lua script to execute.
        options - The script option that contains the non-key arguments for the script.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A value that depends on the script that was executed.
        See Also:
        SCRIPT LOAD and EVALSHA for details.
      • scriptExists

        public java.util.concurrent.CompletableFuture<java.lang.Boolean[]> scriptExists​(@NonNull
                                                                                        @NonNull java.lang.String[] sha1s)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Checks existence of scripts in the script cache by their SHA1 digest.
        The command will be routed to all primary nodes.
        Specified by:
        scriptExists in interface ScriptingAndFunctionsClusterCommands
        Overrides:
        scriptExists in class BaseClient
        Parameters:
        sha1s - SHA1 digests of Lua scripts to be checked.
        Returns:
        An array of boolean values indicating the existence of each script.
        See Also:
        SCRIPT EXISTS for details.
      • scriptExists

        public java.util.concurrent.CompletableFuture<java.lang.Boolean[]> scriptExists​(@NonNull
                                                                                        @NonNull java.lang.String[] sha1s,
                                                                                        @NonNull
                                                                                        @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Checks existence of scripts in the script cache by their SHA1 digest.
        Specified by:
        scriptExists in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        sha1s - SHA1 digests of Lua scripts to be checked.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        An array of boolean values indicating the existence of each script.
        See Also:
        SCRIPT EXISTS for details.
      • scriptExists

        public java.util.concurrent.CompletableFuture<java.lang.Boolean[]> scriptExists​(@NonNull
                                                                                        @NonNull GlideString[] sha1s,
                                                                                        @NonNull
                                                                                        @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Checks existence of scripts in the script cache by their SHA1 digest.
        Specified by:
        scriptExists in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        sha1s - SHA1 digests of Lua scripts to be checked.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        An array of boolean values indicating the existence of each script.
        See Also:
        SCRIPT EXISTS for details.
      • functionStats

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>>>> functionStats()
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the function that's currently running and information about the available execution engines.
        The command will be routed to all nodes.
        Specified by:
        functionStats in interface ScriptingAndFunctionsClusterCommands
        Returns:
        A Map with two keys:
        • running_script with information about the running script.
        • engines with information about available engines and their stats.
        See example for more details.
        See Also:
        valkey.io for details.
      • functionStatsBinary

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<GlideString,​java.util.Map<GlideString,​java.lang.Object>>>> functionStatsBinary()
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the function that's currently running and information about the available execution engines.
        The command will be routed to all nodes.
        Specified by:
        functionStatsBinary in interface ScriptingAndFunctionsClusterCommands
        Returns:
        A Map with two keys:
        • running_script with information about the running script.
        • engines with information about available engines and their stats.
        See example for more details.
        See Also:
        valkey.io for details.
      • functionStats

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>>>> functionStats​(@NonNull
                                                                                                                                                                                @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the function that's currently running and information about the available execution engines.
        Specified by:
        functionStats in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A Map with two keys:
        • running_script with information about the running script.
        • engines with information about available engines and their stats.
        See example for more details.
        See Also:
        valkey.io for details.
      • functionStatsBinary

        public java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<GlideString,​java.util.Map<GlideString,​java.lang.Object>>>> functionStatsBinary​(@NonNull
                                                                                                                                                                            @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ScriptingAndFunctionsClusterCommands
        Returns information about the function that's currently running and information about the available execution engines.
        Specified by:
        functionStatsBinary in interface ScriptingAndFunctionsClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A Map with two keys:
        • running_script with information about the running script.
        • engines with information about available engines and their stats.
        See example for more details.
        See Also:
        valkey.io for details.
      • publish

        public java.util.concurrent.CompletableFuture<java.lang.String> publish​(@NonNull
                                                                                @NonNull java.lang.String message,
                                                                                @NonNull
                                                                                @NonNull java.lang.String channel,
                                                                                boolean sharded)
        Description copied from interface: PubSubClusterCommands
        Publishes message on pubsub channel.
        Specified by:
        publish in interface PubSubClusterCommands
        Parameters:
        message - The message to publish.
        channel - The channel to publish the message on.
        sharded - Indicates that this should be run in sharded mode. Setting sharded to true is only applicable with Valkey 7.0+.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • publish

        public java.util.concurrent.CompletableFuture<java.lang.String> publish​(@NonNull
                                                                                @NonNull GlideString message,
                                                                                @NonNull
                                                                                @NonNull GlideString channel,
                                                                                boolean sharded)
        Description copied from interface: PubSubClusterCommands
        Publishes message on pubsub channel.
        Specified by:
        publish in interface PubSubClusterCommands
        Parameters:
        message - The message to publish.
        channel - The channel to publish the message on.
        sharded - Indicates that this should be run in sharded mode. Setting sharded to true is only applicable with Valkey 7.0+.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • pubsubShardChannels

        public java.util.concurrent.CompletableFuture<java.lang.String[]> pubsubShardChannels()
        Description copied from interface: PubSubClusterCommands
        Lists the currently active shard channels.
        Specified by:
        pubsubShardChannels in interface PubSubClusterCommands
        Returns:
        An array of all active shard channels.
        See Also:
        valkey.io for details.
      • pubsubShardChannels

        public java.util.concurrent.CompletableFuture<java.lang.String[]> pubsubShardChannels​(@NonNull
                                                                                              @NonNull java.lang.String pattern)
        Description copied from interface: PubSubClusterCommands
        Lists the currently active shard channels.
        Specified by:
        pubsubShardChannels in interface PubSubClusterCommands
        Parameters:
        pattern - A glob-style pattern to match active shard channels.
        Returns:
        An array of currently active shard channels matching the given pattern.
        See Also:
        valkey.io for details.
      • pubsubShardChannels

        public java.util.concurrent.CompletableFuture<GlideString[]> pubsubShardChannels​(@NonNull
                                                                                         @NonNull GlideString pattern)
        Description copied from interface: PubSubClusterCommands
        Lists the currently active shard channels.
        Specified by:
        pubsubShardChannels in interface PubSubClusterCommands
        Parameters:
        pattern - A glob-style pattern to match active shard channels.
        Returns:
        An array of currently active shard channels matching the given pattern.
        See Also:
        valkey.io for details.
      • pubsubShardNumSub

        public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Long>> pubsubShardNumSub​(@NonNull
                                                                                                                              @NonNull java.lang.String[] channels)
        Description copied from interface: PubSubClusterCommands
        Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified shard channels. Note that it is valid to call this command without channels. In this case, it will just return an empty map.
        Specified by:
        pubsubShardNumSub in interface PubSubClusterCommands
        Parameters:
        channels - The list of shard channels to query for the number of subscribers.
        Returns:
        An Map where keys are the shard channel names and values are the number of subscribers.
        See Also:
        valkey.io for details.
      • pubsubShardNumSub

        public java.util.concurrent.CompletableFuture<java.util.Map<GlideString,​java.lang.Long>> pubsubShardNumSub​(@NonNull
                                                                                                                         @NonNull GlideString[] channels)
        Description copied from interface: PubSubClusterCommands
        Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified shard channels. Note that it is valid to call this command without channels. In this case, it will just return an empty map.
        Specified by:
        pubsubShardNumSub in interface PubSubClusterCommands
        Parameters:
        channels - The list of shard channels to query for the number of subscribers.
        Returns:
        An Map where keys are the shard channel names and values are the number of subscribers.
        See Also:
        valkey.io for details.
      • unwatch

        public java.util.concurrent.CompletableFuture<java.lang.String> unwatch​(@NonNull
                                                                                @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: TransactionsClusterCommands
        Flushes all the previously watched keys for a transaction. Executing a transaction will automatically flush all previously watched keys.
        Specified by:
        unwatch in interface TransactionsClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • unwatch

        public java.util.concurrent.CompletableFuture<java.lang.String> unwatch()
        Description copied from interface: TransactionsClusterCommands
        Flushes all the previously watched keys for a transaction. Executing a transaction will automatically flush all previously watched keys.
        The command will be routed to all primary nodes.
        Specified by:
        unwatch in interface TransactionsClusterCommands
        Returns:
        OK.
        See Also:
        valkey.io for details.
      • randomKey

        public java.util.concurrent.CompletableFuture<java.lang.String> randomKey​(@NonNull
                                                                                  @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: GenericClusterCommands
        Returns a random key.
        Specified by:
        randomKey in interface GenericClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route, and will return the first successful result.
        Returns:
        A random key from the database.
        See Also:
        valkey.io for details.
      • randomKeyBinary

        public java.util.concurrent.CompletableFuture<GlideString> randomKeyBinary​(@NonNull
                                                                                   @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: GenericClusterCommands
        Returns a random key.
        Specified by:
        randomKeyBinary in interface GenericClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route, and will return the first successful result.
        Returns:
        A random key from the database.
        See Also:
        valkey.io for details.
      • randomKey

        public java.util.concurrent.CompletableFuture<java.lang.String> randomKey()
        Description copied from interface: GenericClusterCommands
        Returns a random key.
        The command will be routed to all primary nodes, and will return the first successful result.
        Specified by:
        randomKey in interface GenericClusterCommands
        Returns:
        A random key from the database.
        See Also:
        valkey.io for details.
      • randomKeyBinary

        public java.util.concurrent.CompletableFuture<GlideString> randomKeyBinary()
        Description copied from interface: GenericClusterCommands
        Returns a random key.
        The command will be routed to all primary nodes, and will return the first successful result.
        Specified by:
        randomKeyBinary in interface GenericClusterCommands
        Returns:
        A random key from the database.
        See Also:
        valkey.io for details.
      • keys

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String[]>> keys​(java.lang.String pattern)
        Description copied from interface: GenericClusterCommands
        Returns all keys matching pattern.
        The command will be routed to all primary nodes.
        Specified by:
        keys in interface GenericClusterCommands
        Parameters:
        pattern - The pattern to match keys against.
        Returns:
        A Map where each key is a node address and the value is an array of keys matching the pattern on that node.
        See Also:
        valkey.io for details.
      • keys

        public java.util.concurrent.CompletableFuture<ClusterValue<GlideString[]>> keys​(GlideString pattern)
        Description copied from interface: GenericClusterCommands
        Returns all keys matching pattern.
        The command will be routed to all primary nodes.
        Specified by:
        keys in interface GenericClusterCommands
        Parameters:
        pattern - The pattern to match keys against.
        Returns:
        A Map where each key is a node address and the value is an array of keys matching the pattern on that node.
        See Also:
        valkey.io for details.
      • keys

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String[]>> keys​(java.lang.String pattern,
                                                                                             @NonNull
                                                                                             @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: GenericClusterCommands
        Returns all keys matching pattern.
        Specified by:
        keys in interface GenericClusterCommands
        Parameters:
        pattern - The pattern to match keys against.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A String array of keys matching the pattern when routed to a single node, or a Map where each key is a node address and the value is an array of keys when routed to multiple nodes.
        See Also:
        valkey.io for details.
      • keys

        public java.util.concurrent.CompletableFuture<ClusterValue<GlideString[]>> keys​(GlideString pattern,
                                                                                        @NonNull
                                                                                        @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: GenericClusterCommands
        Returns all keys matching pattern.
        Specified by:
        keys in interface GenericClusterCommands
        Parameters:
        pattern - The pattern to match keys against.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        A GlideString array of keys matching the pattern when routed to a single node, or a Map where each key is a node address and the value is an array of keys when routed to multiple nodes.
        See Also:
        valkey.io for details.
      • wait

        public java.util.concurrent.CompletableFuture<java.lang.Long> wait​(long numreplicas,
                                                                           long timeout)
        Description copied from interface: GenericBaseCommands
        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.
        Specified by:
        wait in interface GenericBaseCommands
        Overrides:
        wait in class BaseClient
        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.
      • waitaof

        public java.util.concurrent.CompletableFuture<java.lang.Long[]> waitaof​(long numlocal,
                                                                                long numreplicas,
                                                                                long timeout,
                                                                                @NonNull
                                                                                @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ServerManagementClusterCommands
        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.
        Specified by:
        waitaof in interface ServerManagementClusterCommands
        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.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        An array of two Long values: the number of local replicas reached and the number of replicas reached.
        See Also:
        valkey.io for details.
      • scan

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> scan​(ClusterScanCursor cursor)
        Description copied from interface: GenericClusterCommands
        Incrementally iterates over the keys in the Cluster.

        This command is similar to the SCAN command, but it is designed to work in a Cluster environment. The main difference is that this command uses a ClusterScanCursor object to manage iterations. For more information about the Cluster Scan implementation, see Cluster Scan.

        As with the SCAN command, this command is a cursor-based iterator. This means that at every call of the command, the server returns an updated cursor (ClusterScanCursor) that the user needs to re-send as the cursor argument in the next call. The iteration terminates when the returned cursor ClusterScanCursor.isFinished() returns true.

        This method guarantees that all keyslots available when the first SCAN is called will be scanned before the cursor is finished. Any keys added after the initial scan request is made are not guaranteed to be scanned.

        Note that the same key may be returned in multiple scan iterations.

        How to use the ClusterScanCursor:
        For each iteration, the previous scan ClusterScanCursor object should be used to continue the SCAN by passing it in the cursor argument. Using the same cursor object for multiple iterations may result in the same keys returned or unexpected behavior.

        When the cursor is no longer needed, call ClusterScanCursor.releaseCursorHandle() to immediately free resources tied to the cursor. Note that this makes the cursor unusable in subsequent calls to SCAN.

        Specified by:
        scan in interface GenericClusterCommands
        Parameters:
        cursor - The ClusterScanCursor object that wraps the scan state. To start a new scan, create a new empty ClusterScanCursor using ClusterScanCursor.initialCursor().
        Returns:
        An Array with two elements. The first element is always the ClusterScanCursor for the next iteration of results. To see if there is more data on the given cursor, call ClusterScanCursor.isFinished(). To release resources for the current cursor immediately, call ClusterScanCursor.releaseCursorHandle() after using the cursor in a call to this method. The cursor cannot be used in a scan again after ClusterScanCursor.releaseCursorHandle() has been called. The second element is an Array of String elements each representing a key.
        See Also:
        valkey.io for details.
      • scanBinary

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> scanBinary​(ClusterScanCursor cursor)
        Description copied from interface: GenericClusterCommands
        Incrementally iterates over the keys in the Cluster.

        This command is similar to the SCAN command, but it is designed to work in a Cluster environment. The main difference is that this command uses a ClusterScanCursor object to manage iterations. For more information about the Cluster Scan implementation, see Cluster Scan.

        As with the SCAN command, this command is a cursor-based iterator. This means that at every call of the command, the server returns an updated cursor (ClusterScanCursor) that the user needs to re-send as the cursor argument in the next call. The iteration terminates when the returned cursor ClusterScanCursor.isFinished() returns true.

        This method guarantees that all keyslots available when the first SCAN is called will be scanned before the cursor is finished. Any keys added after the initial scan request is made are not guaranteed to be scanned.

        Note that the same key may be returned in multiple scan iterations.

        How to use the ClusterScanCursor:
        For each iteration, the previous scan ClusterScanCursor object should be used to continue the SCAN by passing it in the cursor argument. Using the same cursor object for multiple iterations may result in the same keys returned or unexpected behavior.

        When the cursor is no longer needed, call ClusterScanCursor.releaseCursorHandle() to immediately free resources tied to the cursor. Note that this makes the cursor unusable in subsequent calls to SCAN.

        Specified by:
        scanBinary in interface GenericClusterCommands
        Parameters:
        cursor - The ClusterScanCursor object that wraps the scan state. To start a new scan, create a new empty ClusterScanCursor using ClusterScanCursor.initialCursor().
        Returns:
        An Array with two elements. The first element is always the ClusterScanCursor for the next iteration of results. To see if there is more data on the given cursor, call ClusterScanCursor.isFinished(). To release resources for the current cursor immediately, call ClusterScanCursor.releaseCursorHandle() after using the cursor in a call to this method. The cursor cannot be used in a scan again after ClusterScanCursor.releaseCursorHandle() has been called. The second element is an Array of GlideString elements each representing a key.
        See Also:
        valkey.io for details.
      • scan

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> scan​(ClusterScanCursor cursor,
                                                                               ScanOptions options)
        Description copied from interface: GenericClusterCommands
        Incrementally iterates over the keys in the Cluster.

        This command is similar to the SCAN command, but it is designed to work in a Cluster environment. The main difference is that this command uses a ClusterScanCursor object to manage iterations. For more information about the Cluster Scan implementation, see Cluster Scan.

        As with the SCAN command, this command is a cursor-based iterator. This means that at every call of the command, the server returns an updated cursor (ClusterScanCursor) that the user needs to re-send as the cursor argument in the next call. The iteration terminates when the returned cursor ClusterScanCursor.isFinished() returns true.

        This method guarantees that all keyslots available when the first SCAN is called will be scanned before the cursor is finished. Any keys added after the initial scan request is made are not guaranteed to be scanned.

        Note that the same key may be returned in multiple scan iterations.

        How to use the ClusterScanCursor:
        For each iteration, the previous scan ClusterScanCursor object should be used to continue the SCAN by passing it in the cursor argument. Using the same cursor object for multiple iterations may result in the same keys returned or unexpected behavior.

        When the cursor is no longer needed, call ClusterScanCursor.releaseCursorHandle() to immediately free resources tied to the cursor. Note that this makes the cursor unusable in subsequent calls to SCAN.

        Specified by:
        scan in interface GenericClusterCommands
        Parameters:
        cursor - The ClusterScanCursor object that wraps the scan state. To start a new scan, create a new empty ClusterScanCursor using ClusterScanCursor.initialCursor().
        options - The ScanOptions.
        Returns:
        An Array with two elements. The first element is always the ClusterScanCursor for the next iteration of results. To see if there is more data on the given cursor, call ClusterScanCursor.isFinished(). To release resources for the current cursor immediately, call ClusterScanCursor.releaseCursorHandle() after using the cursor in a call to this method. The cursor cannot be used in a scan again after ClusterScanCursor.releaseCursorHandle() has been called. The second element is an Array of String elements each representing a key.
        See Also:
        valkey.io for details.
      • scanBinary

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> scanBinary​(ClusterScanCursor cursor,
                                                                                     ScanOptions options)
        Description copied from interface: GenericClusterCommands
        Incrementally iterates over the keys in the Cluster.

        This command is similar to the SCAN command, but it is designed to work in a Cluster environment. The main difference is that this command uses a ClusterScanCursor object to manage iterations. For more information about the Cluster Scan implementation, see Cluster Scan.

        As with the SCAN command, this command is a cursor-based iterator. This means that at every call of the command, the server returns an updated cursor (ClusterScanCursor) that the user needs to re-send as the cursor argument in the next call. The iteration terminates when the returned cursor ClusterScanCursor.isFinished() returns true.

        This method guarantees that all keyslots available when the first SCAN is called will be scanned before the cursor is finished. Any keys added after the initial scan request is made are not guaranteed to be scanned.

        Note that the same key may be returned in multiple scan iterations.

        How to use the ClusterScanCursor:
        For each iteration, the previous scan ClusterScanCursor object should be used to continue the SCAN by passing it in the cursor argument. Using the same cursor object for multiple iterations may result in the same keys returned or unexpected behavior.

        When the cursor is no longer needed, call ClusterScanCursor.releaseCursorHandle() to immediately free resources tied to the cursor. Note that this makes the cursor unusable in subsequent calls to SCAN.

        Specified by:
        scanBinary in interface GenericClusterCommands
        Parameters:
        cursor - The ClusterScanCursor object that wraps the scan state. To start a new scan, create a new empty ClusterScanCursor using ClusterScanCursor.initialCursor().
        options - The ScanOptions.
        Returns:
        An Array with two elements. The first element is always the ClusterScanCursor for the next iteration of results. To see if there is more data on the given cursor, call ClusterScanCursor.isFinished(). To release resources for the current cursor immediately, call ClusterScanCursor.releaseCursorHandle() after using the cursor in a call to this method. The cursor cannot be used in a scan again after ClusterScanCursor.releaseCursorHandle() has been called. The second element is an Array of GlideString elements each representing a key.
        See Also:
        valkey.io for details.
      • ssubscribeLazy

        public java.util.concurrent.CompletableFuture<java.lang.Void> ssubscribeLazy​(java.util.Set<java.lang.String> channels)
        Subscribes the client to the specified sharded channels and doesn't wait for confirmation.

        Sharded pubsub (available in Redis 7.0+) allows messages to be published to specific cluster shards, reducing overhead compared to cluster-wide pubsub.

        Specified by:
        ssubscribeLazy in interface PubSubClusterCommands
        Parameters:
        channels - A set of sharded channel names to subscribe to
        Returns:
        A CompletableFuture that completes when the subscription request is processed
        See Also:
        valkey.io for details
        Example:
        
         client.ssubscribe(Set.of("shard-news", "shard-updates")).get();
         
      • ssubscribe

        public java.util.concurrent.CompletableFuture<java.lang.Void> ssubscribe​(java.util.Set<java.lang.String> channels,
                                                                                 int timeoutMs)
        Subscribes the client to the specified sharded channels with a timeout.
        Specified by:
        ssubscribe in interface PubSubClusterCommands
        Parameters:
        channels - A set of sharded channel names to subscribe to
        timeoutMs - Maximum time in milliseconds to wait for subscription confirmation
        Returns:
        A CompletableFuture that completes when the subscription is confirmed or times out
        See Also:
        valkey.io for details
        Example:
        
         client.ssubscribe(Set.of("shard-news", "shard-updates"), 5000).get();
         
      • sunsubscribeLazy

        public java.util.concurrent.CompletableFuture<java.lang.Void> sunsubscribeLazy()
        Unsubscribes the client from all currently subscribed sharded channels.

        This command updates the client's internal desired subscription state without waiting for server confirmation. It returns immediately after updating the local state. The client will attempt to unsubscribe asynchronously in the background.

        Note: Use getSubscriptions() to verify the actual server-side subscription state.

        Specified by:
        sunsubscribeLazy in interface PubSubClusterCommands
        Returns:
        A CompletableFuture that completes when the unsubscription request is processed
        See Also:
        valkey.io for details
        Example:
        
         client.sunsubscribeLazy().get();
         
      • sunsubscribeLazy

        public java.util.concurrent.CompletableFuture<java.lang.Void> sunsubscribeLazy​(java.util.Set<java.lang.String> channels)
        Unsubscribes the client from the specified sharded channels.

        This command updates the client's internal desired subscription state without waiting for server confirmation. It returns immediately after updating the local state. The client will attempt to unsubscribe asynchronously in the background.

        Note: Use getSubscriptions() to verify the actual server-side subscription state.

        Specified by:
        sunsubscribeLazy in interface PubSubClusterCommands
        Parameters:
        channels - A set of sharded channel names to unsubscribe from
        Returns:
        A CompletableFuture that completes when the unsubscription request is processed
        See Also:
        valkey.io for details
        Example:
        
         client.sunsubscribeLazy(Set.of("shard-news", "shard-updates")).get();
         
      • sunsubscribe

        public java.util.concurrent.CompletableFuture<java.lang.Void> sunsubscribe​(java.util.Set<java.lang.String> channels,
                                                                                   int timeoutMs)
        Unsubscribes the client from the specified sharded channels with a timeout.
        Specified by:
        sunsubscribe in interface PubSubClusterCommands
        Parameters:
        channels - A set of sharded channel names to unsubscribe from
        timeoutMs - Maximum time in milliseconds to wait for unsubscription confirmation
        Returns:
        A CompletableFuture that completes when the unsubscription is confirmed or times out
        See Also:
        valkey.io for details
        Example:
        
         client.sunsubscribe(Set.of("shard-news", "shard-updates"), 5000).get();
         
      • sunsubscribe

        public java.util.concurrent.CompletableFuture<java.lang.Void> sunsubscribe​(int timeoutMs)
        Unsubscribes the client from all currently subscribed sharded channels with a timeout.
        Specified by:
        sunsubscribe in interface PubSubClusterCommands
        Parameters:
        timeoutMs - Maximum time in milliseconds to wait for unsubscription confirmation
        Returns:
        A CompletableFuture that completes when the unsubscription is confirmed or times out
        See Also:
        valkey.io for details
        Example:
        
         client.sunsubscribe(5000).get();
         
      • getSubscriptions

        public java.util.concurrent.CompletableFuture<PubSubState<ClusterSubscriptionConfiguration.PubSubClusterChannelMode>> getSubscriptions()
        Gets the current subscription state for this cluster client.

        Returns the desired and actual subscription states, which may differ if subscriptions are being reconciled after a connection loss.

        The returned PubSubState contains:

        • Desired subscriptions: The channels/patterns the client intends to be subscribed to
        • Actual subscriptions: The channels/patterns currently subscribed on the server
        Returns:
        A CompletableFuture that completes with a PubSubState containing:
        • EXACT - Set of exact channel names
        • PATTERN - Set of pattern subscriptions
        • SHARDED - Set of sharded channel subscriptions
        See Also:
        valkey.io for PUBSUB CHANNELS, valkey.io for PUBSUB NUMPAT, valkey.io for PUBSUB SHARDCHANNELS
        Example:
        
         // Get current subscription state
         PubSubState<PubSubClusterChannelMode> state = client.getSubscriptions().get();
        
         // Check desired subscriptions
         Set<String> desiredChannels = state.getDesiredSubscriptions()
             .getOrDefault(PubSubClusterChannelMode.EXACT, Set.of());
         Set<String> desiredSharded = state.getDesiredSubscriptions()
             .getOrDefault(PubSubClusterChannelMode.SHARDED, Set.of());
        
         // Check actual subscriptions
         Set<String> actualChannels = state.getActualSubscriptions()
             .getOrDefault(PubSubClusterChannelMode.EXACT, Set.of());
         
      • clusterMeet

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterMeet​(@NonNull
                                                                                    @NonNull java.lang.String host,
                                                                                    long port)
        Description copied from interface: NodeManagementCommands
        Adds a new node to the cluster. This command is used to connect a new node to the cluster by specifying the IP address and port of the node to add.
        The command will be routed to a random node in the cluster.
        Specified by:
        clusterMeet in interface NodeManagementCommands
        Parameters:
        host - The IP address or hostname of the node to add to the cluster.
        port - The port number of the node to add to the cluster.
        Returns:
        OK if the node was successfully added to the cluster.
        See Also:
        valkey.io for details.
      • clusterMeet

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clusterMeet​(@NonNull
                                                                                                  @NonNull java.lang.String host,
                                                                                                  long port,
                                                                                                  @NonNull
                                                                                                  @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: NodeManagementCommands
        Adds a new node to the cluster. This command is used to connect a new node to the cluster by specifying the IP address and port of the node to add.
        Specified by:
        clusterMeet in interface NodeManagementCommands
        Parameters:
        host - The IP address or hostname of the node to add to the cluster.
        port - The port number of the node to add to the cluster.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        OK if the node was successfully added to the cluster. When specifying a route other than a single node, it returns a Map<String, String> with each address as the key and its corresponding result.
        See Also:
        valkey.io for details.
      • clusterForget

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterForget​(@NonNull
                                                                                      @NonNull java.lang.String nodeId)
        Description copied from interface: NodeManagementCommands
        Removes a node from the cluster. The node is specified by its ID. This command must be sent to a node that is not the one being removed.
        The command will be routed to a random node in the cluster.

        Warning: This is a permanent operation. Once a node is forgotten, it must be re-added to the cluster using NodeManagementCommands.clusterMeet(String, long) if you wish to include it again.

        Specified by:
        clusterForget in interface NodeManagementCommands
        Parameters:
        nodeId - The ID of the node to remove from the cluster. The node ID is a 40-character hexadecimal string.
        Returns:
        OK if the node was successfully removed from the cluster.
        See Also:
        valkey.io for details.
      • clusterReplicate

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterReplicate​(@NonNull
                                                                                         @NonNull java.lang.String nodeId)
        Description copied from interface: NodeManagementCommands
        Configures the current node to replicate data from a primary node identified by nodeId . This command reconfigures a node to become a replica of the specified primary.
        The command must be sent to the node that should become the replica.
        Specified by:
        clusterReplicate in interface NodeManagementCommands
        Parameters:
        nodeId - The ID of the primary node to replicate. The node ID is a 40-character hexadecimal string.
        Returns:
        OK if the node was successfully configured as a replica.
        See Also:
        valkey.io for details.
      • clusterReplicas

        public java.util.concurrent.CompletableFuture<java.lang.String[]> clusterReplicas​(@NonNull
                                                                                          @NonNull java.lang.String nodeId)
        Description copied from interface: NodeManagementCommands
        Returns a list of replicas (slaves) for the specified primary node. Each line in the output represents a replica and contains information similar to the CLUSTER NODES format.
        The command will be routed to a random node in the cluster.
        Specified by:
        clusterReplicas in interface NodeManagementCommands
        Parameters:
        nodeId - The ID of the primary node to get replicas for. The node ID is a 40-character hexadecimal string.
        Returns:
        An array of strings, where each string contains information about a replica node.
        See Also:
        valkey.io for details.
      • clusterReplicas

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String[]>> clusterReplicas​(@NonNull
                                                                                                        @NonNull java.lang.String nodeId,
                                                                                                        @NonNull
                                                                                                        @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: NodeManagementCommands
        Returns a list of replicas (slaves) for the specified primary node. Each line in the output represents a replica and contains information similar to the CLUSTER NODES format.
        Specified by:
        clusterReplicas in interface NodeManagementCommands
        Parameters:
        nodeId - The ID of the primary node to get replicas for. The node ID is a 40-character hexadecimal string.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        An array of strings, where each string contains information about a replica node. When specifying a route other than a single node, it returns a Map<String, String[]> with each address as the key and its corresponding result.
        See Also:
        valkey.io for details.
      • clusterCountFailureReports

        public java.util.concurrent.CompletableFuture<java.lang.Long> clusterCountFailureReports​(@NonNull
                                                                                                 @NonNull java.lang.String nodeId)
        Description copied from interface: NodeManagementCommands
        Returns the number of failure reports for the specified node. Failure reports are the way nodes in the cluster signal that another node might be in a failure state.
        The command will be routed to a random node in the cluster.
        Specified by:
        clusterCountFailureReports in interface NodeManagementCommands
        Parameters:
        nodeId - The ID of the node to get failure report count for. The node ID is a 40-character hexadecimal string.
        Returns:
        The number of active failure reports for the specified node.
        See Also:
        valkey.io for details.
      • clusterCountFailureReports

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Long>> clusterCountFailureReports​(@NonNull
                                                                                                               @NonNull java.lang.String nodeId,
                                                                                                               @NonNull
                                                                                                               @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: NodeManagementCommands
        Returns the number of failure reports for the specified node. Failure reports are the way nodes in the cluster signal that another node might be in a failure state.
        Specified by:
        clusterCountFailureReports in interface NodeManagementCommands
        Parameters:
        nodeId - The ID of the node to get failure report count for. The node ID is a 40-character hexadecimal string.
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        The number of active failure reports for the specified node. When specifying a route other than a single node, it returns a Map<String, Long> with each address as the key and its corresponding result.
        See Also:
        valkey.io for details.
      • clusterFailover

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterFailover()
        Description copied from interface: ClusterOperationsCommands
        Initiates a manual failover of the primary node to one of its replicas. This command must be sent to a replica node. The replica will attempt to perform a failover, becoming the new primary.
        The command must be sent to a replica node.
        Specified by:
        clusterFailover in interface ClusterOperationsCommands
        Returns:
        OK if the failover was successfully initiated.
        See Also:
        valkey.io for details.
      • clusterFailover

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterFailover​(@NonNull
                                                                                        @NonNull ClusterFailoverOptions options)
        Description copied from interface: ClusterOperationsCommands
        Initiates a manual failover of the primary node to one of its replicas with specified options. This command must be sent to a replica node. The replica will attempt to perform a failover, becoming the new primary.
        Specified by:
        clusterFailover in interface ClusterOperationsCommands
        Parameters:
        options - The failover options specifying the type of failover to perform (FORCE or TAKEOVER).
        Returns:
        OK if the failover was successfully initiated.
        See Also:
        valkey.io for details.
      • clusterSetSlot

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterSetSlot​(long slot,
                                                                                       @NonNull
                                                                                       @NonNull ClusterSetSlotOptions options)
        Description copied from interface: ClusterOperationsCommands
        Manages the assignment of hash slots to nodes in the cluster. This command is used during cluster reconfiguration to migrate slots between nodes. The specific action depends on the provided options (IMPORTING, MIGRATING, STABLE, or NODE).
        Specified by:
        clusterSetSlot in interface ClusterOperationsCommands
        Parameters:
        slot - The hash slot number to manage (0-16383).
        options - The options specifying the action to perform on the slot.
        Returns:
        OK if the slot assignment was successfully updated.
        See Also:
        valkey.io for details.
      • clusterBumpEpoch

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterBumpEpoch()
        Description copied from interface: ClusterOperationsCommands
        Forces a node to increment its configuration epoch. This is an advanced command that should be used with caution. It is primarily used during cluster reconfiguration scenarios to force epoch increments.
        Specified by:
        clusterBumpEpoch in interface ClusterOperationsCommands
        Returns:
        BUMPED if the epoch was successfully incremented, or STILL if the current configuration epoch is already the greatest in the cluster.
        See Also:
        valkey.io for details.
      • clusterSetConfigEpoch

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterSetConfigEpoch​(long configEpoch)
        Description copied from interface: ClusterOperationsCommands
        Sets the configuration epoch for a node. This is an advanced command used during cluster reconfiguration. The configuration epoch is a version number for the cluster configuration, and this command allows explicitly setting it.

        Warning: Misuse of this command can lead to cluster inconsistencies. Use with caution and only during controlled reconfiguration scenarios.

        Specified by:
        clusterSetConfigEpoch in interface ClusterOperationsCommands
        Parameters:
        configEpoch - The configuration epoch value to set.
        Returns:
        OK if the configuration epoch was successfully set.
        See Also:
        valkey.io for details.
      • clusterFlushSlots

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterFlushSlots()
        Description copied from interface: ClusterOperationsCommands
        Clears the node's hash slot ownership information. This command removes all slots assigned to the node, effectively clearing its slot assignment cache. This is typically used during cluster reconfiguration or resharding.

        Warning: This is a disruptive operation that clears the node's slot assignments. The node will no longer claim ownership of any slots until they are reassigned.

        Specified by:
        clusterFlushSlots in interface ClusterOperationsCommands
        Returns:
        OK if the slots were successfully flushed.
        See Also:
        valkey.io for details.
      • clusterReset

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterReset()
        Description copied from interface: ClusterOperationsCommands
        Resets a cluster node, clearing its cluster configuration and state. By default, performs a soft reset.
        The command must be sent to the node to reset.

        Warning: This is a destructive operation. A soft reset will clear cluster state but preserve data. Use with caution.

        Specified by:
        clusterReset in interface ClusterOperationsCommands
        Returns:
        OK if the node was successfully reset.
        See Also:
        valkey.io for details.
      • clusterReset

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterReset​(@NonNull
                                                                                     @NonNull ClusterResetOptions options)
        Description copied from interface: ClusterOperationsCommands
        Resets a cluster node with specified options, clearing its cluster configuration and state.
        The command must be sent to the node to reset.

        Warning: This is a destructive operation. A soft reset clears cluster state but preserves data, while a hard reset clears both cluster state and all data. Use with extreme caution, especially with HARD option.

        Specified by:
        clusterReset in interface ClusterOperationsCommands
        Parameters:
        options - The reset options specifying the type of reset (SOFT or HARD).
        Returns:
        OK if the node was successfully reset.
        See Also:
        valkey.io for details.
      • readonly

        public java.util.concurrent.CompletableFuture<java.lang.String> readonly()
        Description copied from interface: ConnectionControlCommands
        Enables read queries for a connection to a cluster replica node. By default, replica nodes in a cluster will redirect read commands to the primary node. This command allows read commands to be executed on the replica node itself.
        This command affects only the current connection and must be sent to a replica node.
        Specified by:
        readonly in interface ConnectionControlCommands
        Returns:
        OK if read-only mode was successfully enabled for this connection.
        See Also:
        valkey.io for details.
      • readwrite

        public java.util.concurrent.CompletableFuture<java.lang.String> readwrite()
        Description copied from interface: ConnectionControlCommands
        Disables read queries for a connection to a cluster replica node. This is the default mode. After calling this command, the replica node will redirect read commands to the primary node.
        This command affects only the current connection and must be sent to a replica node.
        Specified by:
        readwrite in interface ConnectionControlCommands
        Returns:
        OK if read-write mode was successfully restored for this connection.
        See Also:
        valkey.io for details.
      • asking

        public java.util.concurrent.CompletableFuture<java.lang.String> asking()
        Description copied from interface: ConnectionControlCommands
        Allows the execution of commands in the context of a slot migration. When a slot is being migrated from one node to another, this command signals that the current connection is aware of the migration and should allow commands targeting the migrating slot to proceed.
        This is typically used after receiving an ASK redirection error during slot migration.
        Specified by:
        asking in interface ConnectionControlCommands
        Returns:
        OK if the ASKING flag was successfully set for the next command.
        See Also:
        valkey.io for details.
      • clusterSaveConfig

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterSaveConfig()
        Description copied from interface: ClusterAdminCommands
        Saves the cluster configuration to disk. This forces the node to persist its current cluster configuration (including node mappings, slot assignments, etc.) to the cluster configuration file on disk.
        The command will be routed to a random node in the cluster.
        Specified by:
        clusterSaveConfig in interface ClusterAdminCommands
        Returns:
        OK if the configuration was successfully saved.
        See Also:
        valkey.io for details.
      • clusterSaveConfig

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clusterSaveConfig​(@NonNull
                                                                                                        @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterAdminCommands
        Saves the cluster configuration to disk. This forces the node(s) to persist their current cluster configuration (including node mappings, slot assignments, etc.) to the cluster configuration file on disk.
        Specified by:
        clusterSaveConfig in interface ClusterAdminCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        OK if the configuration was successfully saved. When specifying a route other than a single node, it returns a Map<String, String> with each address as the key and its corresponding result.
        See Also:
        valkey.io for details.
      • clusterInfo

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterInfo()
        Description copied from interface: ClusterManagementClusterCommands
        Gets information and statistics about the cluster state.
        The command will be routed to a random node.
        Specified by:
        clusterInfo in interface ClusterManagementClusterCommands
        Returns:
        A String containing cluster state information with key-value pairs separated by newlines. Key fields include:
        • cluster_state - State of the cluster (ok or fail)
        • cluster_slots_assigned - Number of slots assigned
        • cluster_slots_ok - Number of slots in OK state
        • cluster_slots_pfail - Number of slots in PFAIL state
        • cluster_slots_fail - Number of slots in FAIL state
        • cluster_known_nodes - Total number of known nodes
        • cluster_size - Number of primary nodes serving at least one slot
        • cluster_current_epoch - Current cluster epoch
        • cluster_my_epoch - Config epoch of the current node
        • cluster_stats_messages_sent - Number of messages sent
        • cluster_stats_messages_received - Number of messages received
        See Also:
        valkey.io for details.
      • clusterInfo

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clusterInfo​(@NonNull
                                                                                                  @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterManagementClusterCommands
        Gets information and statistics about the cluster state.
        Specified by:
        clusterInfo in interface ClusterManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        When specifying a single-node route, returns a String containing cluster state information. When specifying a multi-node route, returns a Map<String, String> with each node address as the key and its cluster state information as the value.
        See Also:
        valkey.io for details.
      • clusterNodes

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterNodes()
        Description copied from interface: ClusterManagementClusterCommands
        Gets a list of all nodes in the cluster and their attributes.
        The command will be routed to a random node.
        Specified by:
        clusterNodes in interface ClusterManagementClusterCommands
        Returns:
        A String containing information about all nodes in the cluster. Each line represents a node with space-separated fields:
        • node-id - 40-character hex string identifier
        • ip:port@cport - Node address (IPv4, IPv6, or hostname). The @cport is the cluster port used for node-to-node communication
        • flags - Comma-separated list (myself, master, slave, fail?, fail, handshake, noaddr, nofailover, noflags)
        • master-id - Node ID of the master (or "-" if this node is a master)
        • ping-sent - Milliseconds unix time of last ping sent (0 if no ping sent)
        • pong-recv - Milliseconds unix time of last pong received
        • config-epoch - Config epoch of this node
        • link-state - State of the node-to-node link (connected or disconnected)
        • slots - Hash slots served by this node (e.g., 0-5460 or individual slots like 1 2 3)
        See Also:
        valkey.io for details.
      • clusterNodes

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clusterNodes​(@NonNull
                                                                                                   @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterManagementClusterCommands
        Gets a list of all nodes in the cluster and their attributes.
        Specified by:
        clusterNodes in interface ClusterManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        When specifying a single-node route, returns a String containing node information. When specifying a multi-node route, returns a Map<String, String> with each node address as the key and its node listing as the value.
        See Also:
        valkey.io for details.
      • clusterShards

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> clusterShards()
        Description copied from interface: ClusterManagementClusterCommands
        Returns details about the shards of the cluster.
        The command will be routed to a random node.
        Specified by:
        clusterShards in interface ClusterManagementClusterCommands
        Returns:
        An array of maps, where each map represents a shard and contains the following keys:
        • "slots" - An array of slot ranges (each range is a two-element array [start, end])
        • "nodes" - An array of node objects in this shard, each containing:
          • "id" - Node ID (40-character hex string)
          • "endpoint" - Node address (IP and port)
          • "ip" - Node IP address (IPv4 or IPv6)
          • "port" - Node port number
          • "role" - Node role ("master" or "replica")
          • "replication-offset" - Replication offset
          • "health" - Node health status ("online", "failed", "loading")
        See Also:
        valkey.io for details.
      • clusterShards

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[]>> clusterShards​(@NonNull
                                                                                                      @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterManagementClusterCommands
        Returns details about the shards of the cluster.
        Specified by:
        clusterShards in interface ClusterManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        When specifying a single-node route, returns an array of shard information maps. When specifying a multi-node route, returns a Map<String, Object[]> with each node address as the key and its shard details array as the value.
        See Also:
        valkey.io for details.
      • clusterLinks

        public java.util.concurrent.CompletableFuture<java.lang.Object[]> clusterLinks()
        Description copied from interface: ClusterManagementClusterCommands
        Returns information about the TCP links to and from each node in the cluster.
        The command will be routed to a random node.
        Specified by:
        clusterLinks in interface ClusterManagementClusterCommands
        Returns:
        An array of maps, where each map represents a cluster link and contains the following keys:
        • "direction" - Link direction ("to" or "from")
        • "node" - Node ID (40-character hex string) at the other end of the link
        • "create-time" - Timestamp when the link was created (milliseconds)
        • "events" - Event flags for the link (e.g., "r" for readable, "w" for writable)
        • "send-buffer-allocated" - Allocated size of the send buffer
        • "send-buffer-used" - Size of the send buffer currently in use
        • "recv-buffer-allocated" - Allocated size of the receive buffer
        • "recv-buffer-used" - Size of the receive buffer currently in use
        See Also:
        valkey.io for details.
      • clusterLinks

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[]>> clusterLinks​(@NonNull
                                                                                                     @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterManagementClusterCommands
        Returns information about the TCP links to and from each node in the cluster.
        Specified by:
        clusterLinks in interface ClusterManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        When specifying a single-node route, returns an array of link information maps. When specifying a multi-node route, returns a Map<String, Object[]> with each node address as the key and its link details array as the value.
        See Also:
        valkey.io for details.
      • clusterMyId

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterMyId()
        Description copied from interface: ClusterManagementClusterCommands
        Returns the unique identifier (ID) of the current node.
        The command will be routed to a random node.
        Specified by:
        clusterMyId in interface ClusterManagementClusterCommands
        Returns:
        A String containing the unique 40-character identifier of the node executing the command. This ID remains constant for the lifetime of the node and is used in various cluster commands to reference this specific node.
        See Also:
        valkey.io for details.
      • clusterMyId

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clusterMyId​(@NonNull
                                                                                                  @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterManagementClusterCommands
        Returns the unique identifier (ID) of the node(s).
        Specified by:
        clusterMyId in interface ClusterManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        When specifying a single-node route, returns a String containing the node ID. When specifying a multi-node route, returns a Map<String, String> with each node address as the key and its node ID as the value.
        See Also:
        valkey.io for details.
      • clusterMyShardId

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterMyShardId()
        Description copied from interface: ClusterManagementClusterCommands
        Returns the shard ID of the current node.
        The command will be routed to a random node.

        In Valkey, a shard is a set of nodes that replicate the same data (one primary and zero or more replicas). The shard ID is a unique identifier for this replication group and remains constant even during failovers when the primary role transfers to a replica.

        Specified by:
        clusterMyShardId in interface ClusterManagementClusterCommands
        Returns:
        A String containing the unique shard identifier of the current node. All nodes in the same shard (primary and replicas) share the same shard ID.
        See Also:
        valkey.io for details.
      • clusterMyShardId

        public java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> clusterMyShardId​(@NonNull
                                                                                                       @NonNull RequestRoutingConfiguration.Route route)
        Description copied from interface: ClusterManagementClusterCommands
        Returns the shard ID of the node(s).

        In Valkey, a shard is a set of nodes that replicate the same data (one primary and zero or more replicas). The shard ID is a unique identifier for this replication group and remains constant even during failovers when the primary role transfers to a replica.

        Specified by:
        clusterMyShardId in interface ClusterManagementClusterCommands
        Parameters:
        route - Specifies the routing configuration for the command. The client will route the command to the nodes defined by route.
        Returns:
        When specifying a single-node route, returns a String containing the shard ID. When specifying a multi-node route, returns a Map<String, String> with each node address as the key and its shard ID as the value.
        See Also:
        valkey.io for details.
      • clusterKeySlot

        public java.util.concurrent.CompletableFuture<java.lang.Long> clusterKeySlot​(@NonNull
                                                                                     @NonNull java.lang.String key)
        Description copied from interface: ClusterManagementClusterCommands
        Returns the hash slot number for the given key.
        The command will be routed to a random node.

        The hash slot determines which node in a cluster is responsible for a given key. Valkey Cluster uses 16384 hash slots (0-16383). Keys are mapped to slots using CRC16 of the key modulo 16384.

        Specified by:
        clusterKeySlot in interface ClusterManagementClusterCommands
        Parameters:
        key - The key to get the hash slot for.
        Returns:
        The hash slot number (0-16383) for the given key.
        See Also:
        valkey.io for details.
      • clusterKeySlot

        public java.util.concurrent.CompletableFuture<java.lang.Long> clusterKeySlot​(@NonNull
                                                                                     @NonNull GlideString key)
        Description copied from interface: ClusterManagementClusterCommands
        Returns the hash slot number for the given binary key.
        The command will be routed to a random node.
        Specified by:
        clusterKeySlot in interface ClusterManagementClusterCommands
        Parameters:
        key - The binary key to get the hash slot for.
        Returns:
        The hash slot number (0-16383) for the given key.
        See Also:
        valkey.io for details.
      • clusterCountKeysInSlot

        public java.util.concurrent.CompletableFuture<java.lang.Long> clusterCountKeysInSlot​(long slot)
        Description copied from interface: ClusterManagementClusterCommands
        Returns the number of keys in the specified hash slot.
        The command will be routed to the node responsible for the specified slot.
        Specified by:
        clusterCountKeysInSlot in interface ClusterManagementClusterCommands
        Parameters:
        slot - The hash slot number (0-16383) to count keys in.
        Returns:
        The number of keys in the specified slot.
        See Also:
        valkey.io for details.
      • clusterGetKeysInSlot

        public java.util.concurrent.CompletableFuture<java.lang.String[]> clusterGetKeysInSlot​(long slot,
                                                                                               long count)
        Description copied from interface: ClusterAdminCommands
        Returns an array of keys stored in the specified hash slot. This command is useful for inspecting the contents of a slot, particularly during slot migration or resharding operations.
        The command will be routed to the node that owns the specified slot.
        Specified by:
        clusterGetKeysInSlot in interface ClusterAdminCommands
        Specified by:
        clusterGetKeysInSlot in interface ClusterManagementClusterCommands
        Parameters:
        slot - The hash slot number to query (0-16383).
        count - The maximum number of keys to return from the slot.
        Returns:
        An array of keys stored in the specified slot. The array may contain fewer keys than count if the slot has fewer keys.
        See Also:
        valkey.io for details.
      • clusterGetKeysInSlotBinary

        public java.util.concurrent.CompletableFuture<GlideString[]> clusterGetKeysInSlotBinary​(long slot,
                                                                                                long count)
        Description copied from interface: ClusterManagementClusterCommands
        Returns an array of binary keys in the specified hash slot.
        The command will be routed to the node responsible for the specified slot.
        Specified by:
        clusterGetKeysInSlotBinary in interface ClusterManagementClusterCommands
        Parameters:
        slot - The hash slot number (0-16383) to retrieve keys from.
        count - The maximum number of keys to return. Must be positive.
        Returns:
        An array of up to count binary keys belonging to the specified slot. Returns an empty array if the slot is empty or does not exist.
        See Also:
        valkey.io for details.
      • clusterAddSlots

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterAddSlots​(long @NonNull [] slots)
        Description copied from interface: ClusterManagementClusterCommands
        Assigns hash slots to the current node.
        The command will be routed to the node executing the command.
        Specified by:
        clusterAddSlots in interface ClusterManagementClusterCommands
        Parameters:
        slots - An array of hash slot numbers (0-16383) to assign to the node. Slots must not already be assigned to any node.
        Returns:
        "OK" if the slots were successfully assigned.
        See Also:
        valkey.io for details.
      • clusterAddSlotsRange

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterAddSlotsRange​(long[] @NonNull [] slotRanges)
        Description copied from interface: ClusterManagementClusterCommands
        Assigns hash slot ranges to the current node.
        The command will be routed to the node executing the command.

        This command is more efficient than ClusterManagementClusterCommands.clusterAddSlots(long[]) when assigning multiple contiguous slot ranges, as it uses the CLUSTER ADDSLOTSRANGE command introduced in Valkey 7.0.

        Specified by:
        clusterAddSlotsRange in interface ClusterManagementClusterCommands
        Parameters:
        slotRanges - A 2D array where each sub-array contains two elements: [start_slot, end_slot] representing an inclusive range of slots to assign. All slots must be between 0-16383 and not already assigned.
        Returns:
        "OK" if the slot ranges were successfully assigned.
        See Also:
        valkey.io for details.
      • clusterDelSlots

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterDelSlots​(long @NonNull [] slots)
        Description copied from interface: ClusterManagementClusterCommands
        Removes hash slots from the current node.
        The command will be routed to the node executing the command.

        Once a slot is removed, it becomes unassigned and can be assigned to another node or reassigned to the current node. This is typically used during cluster reconfiguration or before removing a node from the cluster.

        Specified by:
        clusterDelSlots in interface ClusterManagementClusterCommands
        Parameters:
        slots - An array of hash slot numbers (0-16383) to remove from the node. Slots must currently be assigned to this node.
        Returns:
        "OK" if the slots were successfully removed.
        See Also:
        valkey.io for details.
      • clusterDelSlotsRange

        public java.util.concurrent.CompletableFuture<java.lang.String> clusterDelSlotsRange​(long[] @NonNull [] slotRanges)
        Description copied from interface: ClusterManagementClusterCommands
        Removes hash slot ranges from the current node.
        The command will be routed to the node executing the command.

        This command is more efficient than ClusterManagementClusterCommands.clusterDelSlots(long[]) when removing multiple contiguous slot ranges, as it uses the CLUSTER DELSLOTSRANGE command introduced in Valkey 7.0.

        Specified by:
        clusterDelSlotsRange in interface ClusterManagementClusterCommands
        Parameters:
        slotRanges - A 2D array where each sub-array contains two elements: [start_slot, end_slot] representing an inclusive range of slots to remove. All slots must be between 0-16383 and currently assigned to this node.
        Returns:
        "OK" if the slot ranges were successfully removed.
        See Also:
        valkey.io for details.