@valkey/valkey-glide
    Preparing search index...

    Type Alias ClusterBatchOptions

    ClusterBatchOptions: {
        retryStrategy?: ClusterBatchRetryStrategy;
        route?: SingleNodeRoute;
    } & BaseBatchOptions

    Options for a batch request for a cluster client.

    Configures single-node routing for the batch request. The client will send the batch to the specified node defined by route.

    ⚠️ Please read ClusterBatchRetryStrategy carefully before enabling these configurations. Defines the retry strategy for handling batch request failures.

    This strategy determines whether failed commands should be retried, potentially impacting execution order.

    • If retryServerError is true, retriable errors (e.g., TRYAGAIN) will trigger a retry.
    • If retryConnectionError is true, connection failures will trigger a retry.

    ⚠️ Warnings:

    • Retrying server errors may cause commands targeting the same slot to execute out of order.
    • Retrying connection errors may lead to duplicate executions, as it is unclear which commands have already been processed.

    Note: Currently, retry strategies are supported only for non-atomic batches.

    Recommendation: It is recommended to increase the timeout in BaseBatchOptions when enabling these strategies.

    Default: Both retryServerError and retryConnectionError are set to false.

    Type Declaration

    • OptionalretryStrategy?: ClusterBatchRetryStrategy

      ⚠️ Please see ClusterBatchRetryStrategy and read carefully before enabling these configurations.

      Defines the retry strategy for handling batch request failures.

      This strategy determines whether failed commands should be retried, potentially impacting execution order.

      • If retryServerError is true, retriable errors (e.g., TRYAGAIN) will trigger a retry.
      • If retryConnectionError is true, connection failures will trigger a retry.

      ⚠️ Warnings:

      • Retrying server errors may cause commands targeting the same slot to execute out of order.
      • Retrying connection errors may lead to duplicate executions, as it is unclear which commands have already been processed.

      Note: Currently, retry strategies are supported only for non-atomic batches.

      Recommendation: It is recommended to increase the timeout in BaseBatchOptions when enabling these strategies.

      Default: Both retryServerError and retryConnectionError are set to false.

    • Optionalroute?: SingleNodeRoute

      Configures single-node routing for the batch request. The client will send the batch to the specified node defined by route.

      If a redirection error occurs:

      • For Atomic Batches (Transactions), the entire transaction will be redirected.
      • For Non-Atomic Batches (Pipelines), only the commands that encountered redirection errors will be redirected.
    const options: ClusterBatchOptions = {
    timeout: 5000, // 5 seconds
    route: "randomNode",
    retryStrategy: {
    retryServerError: false,
    retryConnectionError: false,
    },
    };