redis

package module
v9.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: BSD-2-Clause Imports: 44 Imported by: 17,374

README

Redis client for Go

build workflow PkgGoDev Documentation Go Report Card codecov

Discord Twitch YouTube Twitter Stack Exchange questions

go-redis is the official Redis client library for the Go programming language. It offers a straightforward interface for interacting with Redis servers.

Supported versions

In go-redis we are aiming to support the last three releases of Redis. Currently, this means we do support:

Although the go.mod states it requires at minimum go 1.26, our CI is configured to run the tests against all supported versions of Redis and multiple versions of Go (1.26, oldstable, and stable). We observe that some modules related test may not pass with Redis Stack 7.2 and some commands are changed with Redis CE 8.0. Although it is not officially supported, go-redis/v9 should be able to work with any Redis 7.0+. Please do refer to the documentation and the tests if you experience any issues.

Array data type (Redis 8.8+)

Starting with Redis 8.8, go-redis exposes the new array data type via the AR* command family (ARSET, ARGET, ARGETRANGE, ARMSET, ARMGET, ARINSERT, ARDEL, ARDELRANGE, ARLEN, ARCOUNT, ARNEXT, ARSEEK, ARSCAN, ARGREP, ARRING, ARLASTITEMS, ARINFO/ARINFOFULL, and the AROP* reducers). See array_commands.go for the full surface. The API is experimental and may change in a future release.

How do I Redis?

Learn for free at Redis University

Build faster with the Redis Launchpad

Try the Redis Cloud

Dive in developer tutorials

Join the Redis community

Work at Redis

Resources

old documentation

Ecosystem

Features

Installation

go-redis supports 2 last Go versions and requires a Go version with modules support. So make sure to initialize a Go module:

go mod init github.com/my/repo

Then install go-redis/v9:

go get github.com/redis/go-redis/v9

Quickstart

import (
    "context"
    "fmt"

    "github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func ExampleClient() {
    rdb := redis.NewClient(&redis.Options{
        Addr:     "localhost:6379",
        Password: "", // no password set
        DB:       0,  // use default DB
    })
    defer rdb.Close()

    err := rdb.Set(ctx, "key", "value", 0).Err()
    if err != nil {
        panic(err)
    }

    val, err := rdb.Get(ctx, "key").Result()
    if err != nil {
        panic(err)
    }
    fmt.Println("key", val)

    val2, err := rdb.Get(ctx, "key2").Result()
    if err == redis.Nil {
        fmt.Println("key2 does not exist")
    } else if err != nil {
        panic(err)
    } else {
        fmt.Println("key2", val2)
    }
    // Output: key value
    // key2 does not exist
}
Dial retries and backoff

Connection establishment can be retried by the connection pool when dialing fails.

  • DialerRetries: maximum number of dial attempts (default: 5).
  • DialerRetryTimeout: default delay between attempts when no custom backoff is provided (default: 100ms).
  • DialerRetryBackoff: optional function hook to control the delay between attempts.

Example:

rdb := redis.NewClient(&redis.Options{
	Addr: "localhost:6379",

	DialerRetries:      5,
	DialerRetryTimeout: 100 * time.Millisecond, // used when DialerRetryBackoff is nil

	// Optional: exponential backoff with jitter and a cap.
	DialerRetryBackoff: redis.DialRetryBackoffExponential(100*time.Millisecond, 2*time.Second),
})
defer rdb.Close()
Authentication

The Redis client supports multiple ways to provide authentication credentials, with a clear priority order. Here are the available options:

1. Streaming Credentials Provider (Highest Priority)

The streaming credentials provider allows for dynamic credential updates during the connection lifetime. This is particularly useful for managed identity services and token-based authentication.

type StreamingCredentialsProvider interface {
    Subscribe(listener CredentialsListener) (Credentials, UnsubscribeFunc, error)
}

type CredentialsListener interface {
    OnNext(credentials Credentials)  // Called when credentials are updated
    OnError(err error)              // Called when an error occurs
}

type Credentials interface {
    BasicAuth() (username string, password string)
    RawCredentials() string
}

Example usage:

rdb := redis.NewClient(&redis.Options{
    Addr: "localhost:6379",
    StreamingCredentialsProvider: &MyCredentialsProvider{},
})

Note: The streaming credentials provider can be used with go-redis-entraid to enable Entra ID (formerly Azure AD) authentication. This allows for seamless integration with Azure's managed identity services and token-based authentication.

Example with Entra ID:

import (
    "github.com/redis/go-redis/v9"
    "github.com/redis/go-redis-entraid"
)

// Create an Entra ID credentials provider
provider := entraid.NewDefaultAzureIdentityProvider()

// Configure Redis client with Entra ID authentication
rdb := redis.NewClient(&redis.Options{
    Addr: "your-redis-server.redis.cache.windows.net:6380",
    StreamingCredentialsProvider: provider,
    TLSConfig: &tls.Config{
        MinVersion: tls.VersionTLS12,
    },
})
2. Context-based Credentials Provider

The context-based provider allows credentials to be determined at the time of each operation, using the context.

rdb := redis.NewClient(&redis.Options{
    Addr: "localhost:6379",
    CredentialsProviderContext: func(ctx context.Context) (string, string, error) {
        // Return username, password, and any error
        return "user", "pass", nil
    },
})
3. Regular Credentials Provider

A simple function-based provider that returns static credentials.

rdb := redis.NewClient(&redis.Options{
    Addr: "localhost:6379",
    CredentialsProvider: func() (string, string) {
        // Return username and password
        return "user", "pass"
    },
})
4. Username/Password Fields (Lowest Priority)

The most basic way to provide credentials is through the Username and Password fields in the options.

rdb := redis.NewClient(&redis.Options{
    Addr:     "localhost:6379",
    Username: "user",
    Password: "pass",
})
Priority Order

The client will use credentials in the following priority order:

  1. Streaming Credentials Provider (if set)
  2. Context-based Credentials Provider (if set)
  3. Regular Credentials Provider (if set)
  4. Username/Password fields (if set)

If none of these are set, the client will attempt to connect without authentication.

Protocol Version

The client supports both RESP2 and RESP3 protocols. You can specify the protocol version in the options:

rdb := redis.NewClient(&redis.Options{
    Addr:     "localhost:6379",
    Password: "", // no password set
    DB:       0,  // use default DB
    Protocol: 3,  // specify 2 for RESP 2 or 3 for RESP 3
})
Client-side caching

go-redis supports server-assisted client-side caching for standalone clients. Eligible read replies are stored in the application's memory, so repeated reads can avoid a Redis round trip. Redis tracks which keys each connection has read and sends RESP3 invalidation notifications when those keys change. go-redis uses those notifications to evict affected entries automatically.

Experimental: The client-side caching API may change in a minor release.

Enable the built-in bounded cache with ClientSideCacheConfig:

rdb := redis.NewClient(&redis.Options{
    Addr:     "localhost:6379",
    Protocol: 3,
    DB:       0,
    ClientSideCacheConfig: &redis.ClientSideCacheConfig{
        MaxEntries: 10_000,
    },
})
defer rdb.Close()

Client-side caching currently requires RESP3, a standalone client, and database 0. Fixed Username and Password values are supported. It is disabled when a dynamic credential provider is configured, because cached data must never be reused after the client's ACL identity changes. Only deterministic read commands supported by the cache are stored; writes and streaming responses bypass it.

While client-side caching is enabled, go-redis rejects SELECT, AUTH, HELLO with arguments, RESET, CLIENT TRACKING, and raw SUBSCRIBE, PSUBSCRIBE, or SSUBSCRIBE commands because they would change connection state that the cache relies on. A guarded command also fails its whole pipeline. The typed Subscribe, PSubscribe, and SSubscribe APIs remain supported because they use dedicated connections.

Invalidations are processed asynchronously. DrainInterval controls how often idle connections are checked for them, while MaxStaleness can provide an optional upper bound on an entry's lifetime.

Until a key's invalidation arrives, a cache hit can return a value older than the one on the server. Reads are also not monotonic for one caller. A read that waits twice for another caller's fetch of the same key reads the server directly instead. The other fetch ran on the server earlier, can store its older value afterwards, and a later hit then returns that older value until the invalidation arrives. See the client-side caching example for a working demonstration.

Connecting via a redis url

go-redis also supports connecting via the redis uri specification. The example below demonstrates how the connection can easily be configured using a string, adhering to this specification.

import (
    "github.com/redis/go-redis/v9"
)

func ExampleClient() *redis.Client {
    url := "redis://user:password@localhost:6379/0?protocol=3"
    opts, err := redis.ParseURL(url)
    if err != nil {
        panic(err)
    }

    return redis.NewClient(opts)
}

Instrument with OpenTelemetry
import (
    "github.com/redis/go-redis/v9"
    "github.com/redis/go-redis/extra/redisotel/v9"
    "errors"
)

func main() {
    ...
    rdb := redis.NewClient(&redis.Options{...})

    if err := errors.Join(redisotel.InstrumentTracing(rdb), redisotel.InstrumentMetrics(rdb)); err != nil {
        log.Fatal(err)
    }
Buffer Size Configuration

go-redis uses 32KiB read and write buffers by default for optimal performance. For high-throughput applications or large pipelines, you can customize buffer sizes:

rdb := redis.NewClient(&redis.Options{
    Addr:            "localhost:6379",
    ReadBufferSize:  1024 * 1024, // 1MiB read buffer
    WriteBufferSize: 1024 * 1024, // 1MiB write buffer
})
Automatic pipelining

Experimental — the API may still change. Reach for autopipelining in high-throughput / high-load / scale scenarios; at low concurrency a plain client is simpler and just as fast. A runnable usage tour and throughput comparison live in example/autopipeline.

EXPERIMENTAL: the autopipelining API is subject to change in a future release as we gather feedback — pin your go-redis version if you adopt it.

When many goroutines issue commands concurrently, autopipelining batches them into Redis pipelines automatically — without you writing any pipeline code. It comes in two faces:

  • AutoPipeline() — blocking, drop-in. Each command call blocks until it executes and returns its own value/error, exactly like a normal client, so existing code keeps working unchanged. Under concurrency the engine coalesces commands from all goroutines into deep, back-to-back pipelines (a single ordered batch stream by default), reaching several times a plain client's executed commands per second in the same environment — roughly an order of magnitude with a parallel-batch config (MaxConcurrentBatches > 1 with Unordered). Per-goroutine ordering is preserved.
  • AsyncAutoPipeline() — deferred, highest throughput. Command calls return immediately; you submit a window of commands and read their results afterward, which keeps each pipeline deep — tens of times a plain client's throughput. Ordered by default. Absolute numbers depend heavily on the machine, network path and server; see autopipeline_bench_README.md for the benchmark methodology and multipliers.
rdb := redis.NewClient(&redis.Options{Addr: "localhost:6379"})
defer rdb.Close()
ctx := context.Background()

// Blocking face: drop-in for a normal client, batched under the hood.
ap, err := rdb.AutoPipeline()
if err != nil { // invalid AutoPipelineOptions, or the client is closed
    log.Fatal(err)
}
defer ap.Close()

var wg sync.WaitGroup
for i := 0; i < 1000; i++ {
    wg.Add(1)
    go func(i int) {
        defer wg.Done()
        key := fmt.Sprintf("key:%d", i)
        if err := ap.Set(ctx, key, i, 0).Err(); err != nil { // blocks until executed
            log.Printf("set %s: %v", key, err)
        }
    }(i)
}
wg.Wait()

For maximum throughput, submit a window on the async face and read later:

ctx := context.Background()
ap, err := rdb.AsyncAutoPipeline() // ordered by default
if err != nil {
    log.Fatal(err)
}
defer ap.Close()

cmds := make([]*redis.StatusCmd, 0, 200)
for i := 0; i < 200; i++ {
    cmds = append(cmds, ap.Set(ctx, fmt.Sprintf("key:%d", i), i, 0)) // returns immediately
}
for _, cmd := range cmds {
    if err := cmd.Err(); err != nil { // blocks until executed
        log.Printf("set: %v", err)
    }
}

Each face has a no-argument form that uses Options.AutoPipelineOptions (or the built-in default) and a WithOptions form that takes an explicit *AutoPipelineOptions; both return (*AutoPipeliner, error) — the error is non-nil for an invalid config or a closed client (e.g. ap, err := rdb.AsyncAutoPipelineWithOptions(&redis.AutoPipelineOptions{MaxConcurrentBatches: 8, Unordered: true})); a handful of parallel batches saturates the link — more permits only add overlapping batches without deepening them. They work on ClusterClient too: commands are routed to the correct shard per key, so a single batch may span many slots; ordering across nodes is per key (same-key commands stay in order, different nodes' sub-pipelines run concurrently). Because batches share a few pipeline connections, autopipelining also needs far fewer connections than a plain client at the same concurrency (see PipelinePoolSize). Autopipelining is only a win under concurrency (or windowed submission) — a single goroutine issuing one blocking command at a time sees little benefit, and a hand-written Pipeline() is still fastest when you can batch by hand.

Caveats: a command's context is not honored once it is queued (batches execute on the autopipeliner's own context) — use a plain client for per-command deadlines. Blocking commands (BLPOP, WAIT, ...) are never batched and run directly on your context — as are SHUTDOWN and MONITOR, which would poison a shared pipeline connection — and Do also bypasses batching with plain Client.Do semantics — prefer the typed methods (ap.Set, ap.Get, ...). On a dropped connection a batch is retried whole (up to MaxRetries), so non-idempotent commands may execute twice. Both faces return a cached, client-shared instance: the first call's config wins and Close stops it for all callers. Hooks may read command results (the engine hands a hook running on the dispatch goroutine the same view a plain pipeline hook gets), but a hook must never issue a command on the same autopipeliner and wait for it — the nested command needs the very dispatch slot the hook is holding, and the engine only recovers by failing that flush after its 30s permit backstops. Options.Limiter is consulted once per batch dispatch (as with a manual pipeline), not once per command. An autopipeliner created on a WithTimeout/WithReadTimeout clone is not stopped by the parent's Close — close it explicitly.

Advanced Configuration

go-redis supports extending the client identification phase to allow projects to send their own custom client identification.

Default Client Identification

By default, go-redis automatically sends the client library name and version during the connection process. This feature is available in redis-server as of version 7.2. As a result, the command is "fire and forget", meaning it should fail silently, in the case that the redis server does not support this feature.

Disabling Client Identification

The DisableIdentity option disables sending the client library name and version with CLIENT SETINFO during connection initialization. It does not disable authentication or TLS certificate verification. Initially there was a typo and the option was named DisableIndentity instead of DisableIdentity. The misspelled option is marked as Deprecated and will be removed in V10 of this library. Although both options will work at the moment, the correct option is DisableIdentity. The deprecated option will be removed in V10 of this library, so please use the correct option name to avoid any issues.

To disable client identification, set the DisableIdentity option to true in the Redis client options:

rdb := redis.NewClient(&redis.Options{
    Addr:            "localhost:6379",
    Password:        "",
    DB:              0,
    DisableIdentity: true, // Disable set-info on connect
})
RESP3 for RediSearch Commands (UnstableResp3 is deprecated)

As of v9.20, FT.SEARCH, FT.AGGREGATE, FT.INFO, FT.SPELLCHECK, and FT.SYNDUMP parse RESP3 (map) responses into the same typed result objects as RESP2. No flag is required — Val() / Result() work uniformly on both protocols.

The legacy UnstableResp3 option is now a no-op and is retained on every options struct only for backwards compatibility. It will be removed in a future release; new code should not set it.

RawResult() / RawVal() continue to work for callers that prefer the raw RESP payload directly:

res1, err := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{}).RawResult()
val1 := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{}).RawVal()
Redis-Search Default Dialect

In the Redis-Search module, the default dialect is 2. If needed, you can explicitly specify a different dialect using the appropriate configuration in your queries.

Important: Be aware that the query dialect may impact the results returned. If needed, you can revert to a different dialect version by passing the desired dialect in the arguments of the command you want to execute. For example:

	res2, err := rdb.FTSearchWithArgs(ctx,
		"idx:bicycle",
		"@pickup_zone:[CONTAINS $bike]",
		&redis.FTSearchOptions{
			Params: map[string]interface{}{
				"bike": "POINT(-0.1278 51.5074)",
			},
			DialectVersion: 3,
		},
	).Result()

You can find further details in the query dialect documentation.

Custom buffer sizes

Prior to v9.12, the buffer size was the default go value of 4096 bytes. Starting from v9.12, go-redis uses 32KiB read and write buffers by default for optimal performance. For high-throughput applications or large pipelines, you can customize buffer sizes:

rdb := redis.NewClient(&redis.Options{
    Addr:            "localhost:6379",
    ReadBufferSize:  1024 * 1024, // 1MiB read buffer
    WriteBufferSize: 1024 * 1024, // 1MiB write buffer
})

Important: If you experience any issues with the default buffer sizes, please try setting them to the go default of 4096 bytes.

Contributing

We welcome contributions to the go-redis library! If you have a bug fix, feature request, or improvement, please open an issue or pull request on GitHub. We appreciate your help in making go-redis better for everyone. If you are interested in contributing to the go-redis library, please check out our contributing guidelines for more information on how to get started.

Look and feel

Some corner cases:

// SET key value EX 10 NX
set, err := rdb.SetNX(ctx, "key", "value", 10*time.Second).Result()

// SET key value keepttl NX
set, err := rdb.SetNX(ctx, "key", "value", redis.KeepTTL).Result()

// SORT list LIMIT 0 2 ASC
vals, err := rdb.Sort(ctx, "list", &redis.Sort{Offset: 0, Count: 2, Order: "ASC"}).Result()

// ZRANGEBYSCORE zset -inf +inf WITHSCORES LIMIT 0 2
vals, err := rdb.ZRangeByScoreWithScores(ctx, "zset", &redis.ZRangeBy{
    Min: "-inf",
    Max: "+inf",
    Offset: 0,
    Count: 2,
}).Result()

// ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3 AGGREGATE SUM
vals, err := rdb.ZInterStore(ctx, "out", &redis.ZStore{
    Keys: []string{"zset1", "zset2"},
    Weights: []int64{2, 3}
}).Result()

// EVAL "return {KEYS[1],ARGV[1]}" 1 "key" "hello"
vals, err := rdb.Eval(ctx, "return {KEYS[1],ARGV[1]}", []string{"key"}, "hello").Result()

// custom command
res, err := rdb.Do(ctx, "set", "key", "value").Result()
Raw commands and connection state

Do sends the command verbatim on whichever pooled connection happens to be free. For keyspace commands that is all you need. It is the wrong tool for any command that alters connection session state — SELECT, CLIENT SETNAME, CLIENT TRACKING, RESET, HIMPORT PREPARE/DISCARD, and similar: the state lands on (or is wiped from) a single arbitrary connection, later commands are served by other connections that don't share it, and the affected connection eventually returns to the pool and serves unrelated callers. The result is nondeterministic behavior that typed APIs manage for you — for example, the typed HImport* methods keep a client-side registry and replay fieldsets onto every connection that needs them, while a raw Do(ctx, "himport", "prepare", ...) bypasses that entirely, with no replay, recovery, or discard propagation.

For session-scoped work without a typed API, hold a dedicated connection (client.EphemeralConn()) for its whole lifetime and close it afterwards. client.Conn() is also a dedicated connection, but Close returns it to the pool with whatever session state is left on it, so it only suits commands that leave the connection as they found it.

Typed Errors

go-redis provides typed error checking functions for common Redis errors:

// Cluster and replication errors
redis.IsLoadingError(err)        // Redis is loading the dataset
redis.IsReadOnlyError(err)       // Write to read-only replica
redis.IsClusterDownError(err)    // Cluster is down
redis.IsTryAgainError(err)       // Command should be retried
redis.IsMasterDownError(err)     // Master is down
redis.IsMovedError(err)          // Returns (address, true) if key moved
redis.IsAskError(err)            // Returns (address, true) if key being migrated

// Connection and resource errors
redis.IsMaxClientsError(err)     // Maximum clients reached
redis.IsAuthError(err)           // Authentication failed (NOAUTH, WRONGPASS, unauthenticated)
redis.IsPermissionError(err)     // Permission denied (NOPERM)
redis.IsOOMError(err)            // Out of memory (OOM)

// Transaction errors
redis.IsExecAbortError(err)      // Transaction aborted (EXECABORT)
Error Wrapping in Hooks

When wrapping errors in hooks, use custom error types with Unwrap() method (preferred) or fmt.Errorf with %w. Always call cmd.SetErr() to preserve error type information:

// Custom error type (preferred)
type AppError struct {
    Code      string
    RequestID string
    Err       error
}

func (e *AppError) Error() string {
    return fmt.Sprintf("[%s] request_id=%s: %v", e.Code, e.RequestID, e.Err)
}

func (e *AppError) Unwrap() error {
    return e.Err
}

// Hook implementation
func (h MyHook) ProcessHook(next redis.ProcessHook) redis.ProcessHook {
    return func(ctx context.Context, cmd redis.Cmder) error {
        err := next(ctx, cmd)
        if err != nil {
            // Wrap with custom error type
            wrappedErr := &AppError{
                Code:      "REDIS_ERROR",
                RequestID: getRequestID(ctx),
                Err:       err,
            }
            cmd.SetErr(wrappedErr)
            return wrappedErr  // Return wrapped error to preserve it
        }
        return nil
    }
}

// Typed error detection works through wrappers
if redis.IsLoadingError(err) {
    // Retry logic
}

// Extract custom error if needed
var appErr *AppError
if errors.As(err, &appErr) {
    log.Printf("Request: %s", appErr.RequestID)
}

Alternatively, use fmt.Errorf with %w:

wrappedErr := fmt.Errorf("context: %w", err)
cmd.SetErr(wrappedErr)
Pipeline Hook Example

For pipeline operations, use ProcessPipelineHook:

type PipelineLoggingHook struct{}

func (h PipelineLoggingHook) DialHook(next redis.DialHook) redis.DialHook {
    return next
}

func (h PipelineLoggingHook) ProcessHook(next redis.ProcessHook) redis.ProcessHook {
    return next
}

func (h PipelineLoggingHook) ProcessPipelineHook(next redis.ProcessPipelineHook) redis.ProcessPipelineHook {
    return func(ctx context.Context, cmds []redis.Cmder) error {
        start := time.Now()

        // Execute the pipeline
        err := next(ctx, cmds)

        duration := time.Since(start)
        log.Printf("Pipeline executed %d commands in %v", len(cmds), duration)

        // Process individual command errors
        // Note: Individual command errors are already set on each cmd by the pipeline execution
        for _, cmd := range cmds {
            if cmdErr := cmd.Err(); cmdErr != nil {
                // Check for specific error types using typed error functions
                if redis.IsAuthError(cmdErr) {
                    log.Printf("Auth error in pipeline command %s: %v", cmd.Name(), cmdErr)
                } else if redis.IsPermissionError(cmdErr) {
                    log.Printf("Permission error in pipeline command %s: %v", cmd.Name(), cmdErr)
                }

                // Optionally wrap individual command errors to add context
                // The wrapped error preserves type information through errors.As()
                wrappedErr := fmt.Errorf("pipeline cmd %s failed: %w", cmd.Name(), cmdErr)
                cmd.SetErr(wrappedErr)
            }
        }

        // Return the pipeline-level error (connection errors, etc.)
        // You can wrap it if needed, or return it as-is
        return err
    }
}

// Register the hook
rdb.AddHook(PipelineLoggingHook{})

// Use pipeline - errors are still properly typed
pipe := rdb.Pipeline()
pipe.Set(ctx, "key1", "value1", 0)
pipe.Get(ctx, "key2")
_, err := pipe.Exec(ctx)

Run the test

Recommended to use Docker, just need to run:

make test

See also

Contributors

The go-redis project was originally initiated by ⭐ uptrace/uptrace. Uptrace is an open-source APM tool that supports distributed tracing, metrics, and logs. You can use it to monitor applications and set up automatic alerts to receive notifications via email, Slack, Telegram, and others.

See OpenTelemetry example which demonstrates how you can use Uptrace to monitor go-redis.

Thanks to all the people who already contributed!

Documentation

Overview

Package redis implements a Redis client.

Example (CustomCommand)
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	Get := func(ctx context.Context, rdb *redis.Client, key string) *redis.StringCmd {
		cmd := redis.NewStringCmd(ctx, "get", key)
		rdb.Process(ctx, cmd)
		return cmd
	}

	v, err := Get(ctx, rdb, "key_does_not_exist").Result()
	fmt.Printf("%q %s", v, err)
}
Output:
"" redis: nil
Example (CustomCommand2)
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	v, err := rdb.Do(ctx, "get", "key_does_not_exist").Text()
	fmt.Printf("%q %s", v, err)
}
Output:
"" redis: nil
Example (Instrumentation)
rdb := redis.NewClient(&redis.Options{
	Addr:            ":6379",
	DisableIdentity: true,
})
rdb.AddHook(redisHook{})

rdb.Ping(ctx)
Output:
starting processing: <[ping]>
dialing tcp :6379
finished dialing tcp :6379
starting processing: <[hello 3]>
finished processing: <[hello 3]>
starting processing: <[client maint_notifications on moving-endpoint-type internal-ip]>
finished processing: <[client maint_notifications on moving-endpoint-type internal-ip]>
finished processing: <[ping]>

Index

Examples

Constants

View Source
const (
	NaN  = internal.NaN  // Not a Number
	Inf  = internal.Inf  // Positive infinity
	NInf = internal.NInf // Negative infinity
)

String representations of special float values. Values are lowercase for consistency with Redis RESP2 protocol responses.

View Source
const (
	SearchInvalid = SearchAggregator(iota)
	SearchAvg
	SearchSum
	SearchMin
	SearchMax
	SearchCount
	SearchCountDistinct
	SearchCountDistinctish
	SearchStdDev
	SearchQuantile
	SearchToList
	SearchFirstValue
	SearchRandomSample
	// SearchCollect is the COLLECT reducer for FT.AGGREGATE. Within each
	// GROUPBY group it projects a chosen set of fields from every row and
	// emits them as an array of per-entry maps under the reducer alias.
	// Requires Redis 8.8+ with unstable features enabled
	// (CONFIG SET search-enable-unstable-features yes).
	SearchCollect
)
View Source
const (
	SearchFieldTypeInvalid = SearchFieldType(iota)
	SearchFieldTypeNumeric
	SearchFieldTypeTag
	SearchFieldTypeText
	SearchFieldTypeGeo
	SearchFieldTypeVector
	SearchFieldTypeGeoShape
)
View Source
const (
	XNackModeSilent = "SILENT"
	XNackModeFail   = "FAIL"
	XNackModeFatal  = "FATAL"
)

XNACK modes. See XNackArgs.Mode.

View Source
const (
	TSReadEarliest = "-" // read from the earliest sample
	TSReadLatest   = "+" // latest sample, inclusive
	TSReadNew      = "$" // only samples added after the call
)

TS.READ timestamp cursor sentinels.

View Source
const (
	Invalid = Aggregator(iota)
	Avg
	Sum
	Min
	Max
	Range
	Count
	First
	Last
	StdP
	StdS
	VarP
	VarS
	Twa
	CountNaN
	CountAll
)
View Source
const BitCountIndexBit string = "BIT"
View Source
const BitCountIndexByte string = "BYTE"
View Source
const DefaultPipelineBufferSize = 128 * 1024

DefaultPipelineBufferSize is the per-connection read/write buffer size for the dedicated pipeline pool when no explicit pipeline buffer size is set (the larger of this and the regular buffer size is used). Pipeline connections move whole batches per round trip, so they earn bigger buffers than regular per-command traffic: measured on the autopipeline engine, throughput plateaus around 64 KiB and gains nothing past ~128 KiB for TYPICAL (small-command) traffic, while very large buffers (>=512 KiB) can regress it.

Set to 128 KiB anyway: the extra headroom is not about typical-traffic throughput but about full-duplex's large-payload backpressure guardrail (see MaxBatchBytes's default) — more bufio headroom before a write() to a slow-draining peer blocks widens the margin before that guardrail's cap is reached. The aggregate memory cost stays negligible because the pool this backs holds few connections: the dedicated pipeline pool never pre-dials (DefaultPipelinePoolSize, MinIdleConns forced to 0), and full-duplex holds exactly one connection per node regardless of pool size.

View Source
const DefaultPipelinePoolSize = 10

DefaultPipelinePoolSize is the pipeline pool size used when PipelinePoolSize is not set. Pipelining batches many commands per round trip, so it needs far fewer connections than regular traffic. The pool is pure burst capacity: it never pre-dials idle connections (MinIdleConns is forced to 0 on it), so an unused pipeline pool holds no connections at all and the size is only a cap — bursts wider than it spill to the main pool.

View Source
const DefaultPipelinePoolTimeout = 100 * time.Millisecond

DefaultPipelinePoolTimeout is the dedicated pipeline pool's PoolTimeout (pipelinePoolOptions caps the pipeline clone's PoolTimeout at this value but honors a caller's SHORTER PoolTimeout). It does NOT gate the spill to the main pool: withPipelineConn acquires with a non-blocking TryGet, so a burst wider than the pipeline pool's cap spills to the main pool IMMEDIATELY (see the pipeline-pool note in Options and withPipelineConn), never waiting this timeout, and the spilled op then uses the MAIN pool's own PoolTimeout, not this one.

It currently has NO other live effect either. Every acquisition against the dedicated pipeline pool — withPipelineConn's per-round-trip borrow above, and the full-duplex engine's own session lease (autopipeline_fullduplex.go) — uses TryGet, never the blocking Get. TryGet's non-wait branch returns ErrPoolTryFull at once for BOTH a saturated pool turn and an active maintnotifications drainer claim, before waitForDrainer or this deadline is ever consulted (see ConnPool.getConn/waitTurn in internal/pool). A previous version of this doc claimed a residual drainer-handoff budget; that was inaccurate (codex on #4002) — there is no code path that currently waits out this value. It is kept short anyway in case a future acquisition path, or a caller that obtains the pool via getPipelinePool's exported pool.Pooler interface, uses the blocking Get.

View Source
const ErrorTypeNil = "NIL"

ErrorTypeNil is the error type reported to OTelRecorder.RecordError for a Nil reply.

View Source
const KeepTTL = -1

KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error. For example:

rdb.Set(ctx, key, value, redis.KeepTTL)
View Source
const Nil = proto.Nil

Nil reply returned by Redis when key does not exist.

View Source
const TxFailedErr = proto.RedisError("redis: transaction failed")

TxFailedErr transaction redis failed.

View Source
const XTrimLimitDisabled = -1

XTrimLimitDisabled is a sentinel value for the LIMIT argument of stream trimming (XAddArgs.Limit and the XTrim*Approx* commands). Passing it emits an explicit "LIMIT 0", which tells Redis to disable the trimming effort cap entirely. This differs from passing 0, which keeps the historical behavior: no LIMIT clause is sent and Redis applies its implicit default (100 * stream-node-max-entries examined entries).

LIMIT is only valid together with the "~" (approximate) trimming flag; Redis rejects LIMIT used with exact ("=") trimming.

Variables

View Source
var ErrAutoPipelineQueueFull = errors.New(
	"redis: autopipeline: queue full (MaxQueuedCommands reached)",
)

ErrAutoPipelineQueueFull is set on a command rejected because the autopipeliner already holds AutoPipelineOptions.MaxQueuedCommands accepted commands. The command was not sent. The caller may retry it later.

EXPERIMENTAL: this API is subject to change, use with caution.

View Source
var ErrAutoPipelineTimeout = errors.New(
	"redis: autopipeline: no batch permit within the internal backstop (engine overloaded or a batch is wedged)",
)

ErrAutoPipelineTimeout is set on drained commands when a flush could not obtain a batch permit within the engine's internal backstop — the engine is overloaded or an in-flight batch is wedged (e.g. read timeouts disabled on a dead peer). It is deliberately NOT context.DeadlineExceeded: the caller's own context did not expire, and errors.Is(err, context.DeadlineExceeded) must not fire for an internal engine timeout.

EXPERIMENTAL: this API is subject to change, use with caution.

View Source
var ErrClosed = pool.ErrClosed

ErrClosed performs any operation on the closed client will return this error.

View Source
var ErrCrossSlot = proto.RedisError("CROSSSLOT Keys in request don't hash to the same slot")

ErrCrossSlot is returned when keys are used in the same Redis command and the keys are not in the same hash slot. This error is returned by Redis Cluster and will be returned by the client when TxPipeline or TxPipelined is used on a ClusterClient with keys in different slots.

View Source
var ErrFDPipelineDiverts = errors.New(
	"redis: FDPipelined got a command that must be diverted off the full-duplex pipe")

ErrFDPipelineDiverts is returned when a batch contains a command the engine cannot stream (blocking, per-command read timeout, runs-outside-pipeline, HIMPORT, or one the caller's own mustDivert rejects). Such a command has to leave the pipe, which would break the batch's contiguity, so the whole call is refused instead of being silently split. A NoRetry command (e.g. RawWriteTo) is refused too: it makes the batch unreplayable as a unit, which the pipe's per-command recovery cannot honor.

View Source
var ErrFDPipelineSpansEngines = errors.New(
	"redis: FDPipelined batch has keys on different full-duplex engines")

ErrFDPipelineSpansEngines is returned when NumShards > 1 runs several full-duplex engines and the batch's keyed commands hash to different ones. The batch can only ride one wire, and keeping per-first-key order needs each command on its own key's engine, so it is refused rather than split. Pipeline() falls back to an ordinary pipeline for such a batch.

View Source
var ErrFDPipelineTooLarge = errors.New(
	"redis: FDPipelined batch is larger than the full-duplex submit queue")

ErrFDPipelineTooLarge is returned when a batch cannot fit the submit queue even when the queue is empty.

View Source
var ErrFDPipelineUnavailable = errors.New(
	"redis: FDPipelined requires a full-duplex autopipeliner on a standalone Client")

ErrFDPipelineUnavailable is returned when batch submission is requested on an autopipeliner that has no full-duplex engine. It is deliberately an error rather than a silent fallback to the pooled pipeline path: a caller asking for this wants the commands on the FD wire, and quietly running them somewhere else would be measured (or relied upon) as something it is not.

Batch submission is STANDALONE ONLY. A full-duplex autopipeliner on a ClusterClient reports Config().FullDuplex true but runs one engine per node, and a pipeline can span nodes, so it gets this error and its Pipeline() keeps using the cluster pipeline, as it did before FD batches existed.

View Source
var ErrHotKeysNoMetrics = errors.New("redis: at least one metric must be specified for HOTKEYS START")

ErrHotKeysNoMetrics is returned when HotKeysStart is called without any metrics specified.

View Source
var ErrInvalidCommand = errors.New("invalid command type")

ErrInvalidCommand is returned when an invalid command is passed to ExecuteCommand.

View Source
var ErrInvalidPool = errors.New("invalid pool type")

ErrInvalidPool is returned when the pool type is not supported.

View Source
var ErrNoScript = proto.RedisError("NOSCRIPT No matching script. Please use EVAL.")

ErrNoScript is returned when EVALSHA is requested for a script digest that is not available in the script cache. Note that this error text is reproduced literally from that used by Redis.

View Source
var ErrPoolExhausted = pool.ErrPoolExhausted

ErrPoolExhausted is returned from a pool connection method when the maximum number of database connections in the pool has been reached.

View Source
var ErrPoolTimeout = pool.ErrPoolTimeout

ErrPoolTimeout timed out waiting to get a connection from the connection pool.

View Source
var ErrRingAutoPipelineUnsupported = errors.New("redis: AutoPipeline is not supported by Ring")

ErrRingAutoPipelineUnsupported is returned by Ring's AutoPipeline / AsyncAutoPipeline (and their WithOptions forms); check for it with errors.Is. Autopipelining is not implemented for Ring; use the per-shard clients or a ClusterClient. Ring is part of the UniversalClient interface, so these methods exist to satisfy it and fail explicitly rather than being silently absent.

View Source
var ErrSubmitBlockingFace = errors.New(
	"redis: Submit requires the deferred autopipeliner (AsyncAutoPipeline); on the blocking face use the typed methods or Do",
)

ErrSubmitBlockingFace rejects Submit on the blocking face: Submit does not wait, so a windowed caller could have several commands in flight at once — but the blocking face stripes its enqueue queue on the strength of every caller waiting per command, and a non-waiting window there can be reordered. The deferred face (AsyncAutoPipeline) is built for exactly that usage.

EXPERIMENTAL: this API is subject to change, use with caution.

Functions

func DialRetryBackoffConstant added in v9.19.0

func DialRetryBackoffConstant(d time.Duration) func(attempt int) time.Duration

DialRetryBackoffConstant returns a dial retry backoff function that always returns d. attempt is 0-based: attempt=0 is the delay after the 1st failed dial.

func DialRetryBackoffExponential added in v9.19.0

func DialRetryBackoffExponential(minBackoff, maxBackoff time.Duration) func(attempt int) time.Duration

DialRetryBackoffExponential returns a dial retry backoff function that uses exponential backoff with jitter and a cap, using internal.RetryBackoff.

attempt is 0-based: attempt=0 is the delay after the 1st failed dial.

func ExtractCommandValue added in v9.18.0

func ExtractCommandValue(cmd interface{}) (interface{}, error)

ExtractCommandValue extracts the value from a command result using the fast enum-based approach

func HasErrorPrefix

func HasErrorPrefix(err error, prefix string) bool

HasErrorPrefix checks if the err is a Redis error and the message contains a prefix.

func IsAskError added in v9.17.0

func IsAskError(err error) (addr string, ok bool)

IsAskError checks if an error is a Redis ASK error, even if wrapped. ASK errors occur in cluster mode when a key is being migrated and the client should ask another node. Returns the address of the node to ask and a boolean indicating if it's an ASK error.

func IsAuthError added in v9.17.0

func IsAuthError(err error) bool

IsAuthError checks if an error is a Redis authentication error, even if wrapped. Authentication errors occur when: - NOAUTH: Redis requires authentication but none was provided - WRONGPASS: Redis authentication failed due to incorrect password - unauthenticated: Error returned when password changed

func IsClusterDownError added in v9.17.0

func IsClusterDownError(err error) bool

IsClusterDownError checks if an error is a Redis CLUSTERDOWN error, even if wrapped. CLUSTERDOWN errors occur when the cluster is down.

func IsExecAbortError added in v9.17.0

func IsExecAbortError(err error) bool

IsExecAbortError checks if an error is a Redis EXECABORT error, even if wrapped. EXECABORT errors occur when a transaction is aborted.

func IsLoadingError added in v9.17.0

func IsLoadingError(err error) bool

IsLoadingError checks if an error is a Redis LOADING error, even if wrapped. LOADING errors occur when Redis is loading the dataset in memory.

func IsMasterDownError added in v9.17.0

func IsMasterDownError(err error) bool

IsMasterDownError checks if an error is a Redis MASTERDOWN error, even if wrapped. MASTERDOWN errors occur when the master is down.

func IsMaxClientsError added in v9.17.0

func IsMaxClientsError(err error) bool

IsMaxClientsError checks if an error is a Redis max clients error, even if wrapped. This error occurs when the maximum number of clients has been reached.

func IsMovedError added in v9.17.0

func IsMovedError(err error) (addr string, ok bool)

IsMovedError checks if an error is a Redis MOVED error, even if wrapped. MOVED errors occur in cluster mode when a key has been moved to a different node. Returns the address of the node where the key has been moved and a boolean indicating if it's a MOVED error.

func IsNoReplicasError added in v9.18.0

func IsNoReplicasError(err error) bool

IsNoReplicasError checks if an error is a Redis NOREPLICAS error, even if wrapped. NOREPLICAS errors occur when not enough replicas acknowledge a write operation. This typically happens with WAIT/WAITAOF commands or CLUSTER SETSLOT with synchronous replication when the required number of replicas cannot confirm the write within the timeout.

func IsOOMError added in v9.17.0

func IsOOMError(err error) bool

IsOOMError checks if an error is a Redis OOM (Out Of Memory) error, even if wrapped. OOM errors occur when Redis is out of memory.

func IsPermissionError added in v9.17.0

func IsPermissionError(err error) bool

IsPermissionError checks if an error is a Redis permission error, even if wrapped. Permission errors (NOPERM) occur when a user does not have permission to execute a command.

func IsReadOnlyError added in v9.17.0

func IsReadOnlyError(err error) bool

IsReadOnlyError checks if an error is a Redis READONLY error, even if wrapped. READONLY errors occur when trying to write to a read-only replica.

func IsTryAgainError added in v9.17.0

func IsTryAgainError(err error) bool

IsTryAgainError checks if an error is a Redis TRYAGAIN error, even if wrapped. TRYAGAIN errors occur when a command cannot be processed and should be retried.

func NewCommandInfoResolver added in v9.18.0

func NewCommandInfoResolver(resolveFunc CommandInfoResolveFunc) *commandInfoResolver

func NewDefaultCommandPolicyResolver added in v9.18.0

func NewDefaultCommandPolicyResolver() *commandInfoResolver

func NewDialer

func NewDialer(opt *Options) func(context.Context, string, string) (net.Conn, error)

NewDialer returns a function that will be used as the default dialer when none is specified in Options.Dialer.

func NewPushNotificationProcessor added in v9.15.0

func NewPushNotificationProcessor() push.NotificationProcessor

NewPushNotificationProcessor creates a new push notification processor This processor maintains a registry of handlers and processes push notifications It is used for RESP3 connections where push notifications are available

func NewVoidPushNotificationProcessor added in v9.15.0

func NewVoidPushNotificationProcessor() push.NotificationProcessor

NewVoidPushNotificationProcessor creates a new void push notification processor This processor does not maintain any handlers and always returns nil for all operations It is used for RESP2 connections where push notifications are not available It can also be used to disable push notifications for RESP3 connections, where it will discard all push notifications without processing them

func SetLogLevel added in v9.15.0

func SetLogLevel(logLevel internal.LogLevelT)

SetLogLevel sets the log level for the library.

func SetLogger

func SetLogger(logger internal.Logging)

SetLogger set custom log Use with VoidLogger to disable logging. If logger is nil, the call is ignored and the existing logger is kept.

func SetOTelRecorder added in v9.18.0

func SetOTelRecorder(r OTelRecorder)

SetOTelRecorder sets the global OpenTelemetry recorder.

func Version

func Version() string

Version is the current release version.

Types

type ACLCatArgs added in v9.7.2

type ACLCatArgs struct {
	Category string
}

type ACLCmdable added in v9.2.0

type ACLCmdable interface {
	ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd

	ACLLog(ctx context.Context, count int64) *ACLLogCmd
	ACLLogReset(ctx context.Context) *StatusCmd

	ACLGenPass(ctx context.Context, bit int) *StringCmd

	ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd
	ACLDelUser(ctx context.Context, username string) *IntCmd
	ACLUsers(ctx context.Context) *StringSliceCmd
	ACLWhoAmI(ctx context.Context) *StringCmd
	ACLList(ctx context.Context) *StringSliceCmd

	ACLCat(ctx context.Context) *StringSliceCmd
	ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd
}

type ACLLogCmd added in v9.0.5

type ACLLogCmd struct {
	// contains filtered or unexported fields
}

func NewACLLogCmd added in v9.0.5

func NewACLLogCmd(ctx context.Context, args ...interface{}) *ACLLogCmd

func (*ACLLogCmd) Args added in v9.0.5

func (cmd *ACLLogCmd) Args() []interface{}

func (*ACLLogCmd) Clone added in v9.18.0

func (cmd *ACLLogCmd) Clone() Cmder

func (*ACLLogCmd) Err added in v9.0.5

func (cmd *ACLLogCmd) Err() error

func (*ACLLogCmd) FullName added in v9.0.5

func (cmd *ACLLogCmd) FullName() string

func (*ACLLogCmd) GetCmdType added in v9.18.0

func (cmd *ACLLogCmd) GetCmdType() CmdType

func (*ACLLogCmd) Name added in v9.0.5

func (cmd *ACLLogCmd) Name() string

func (*ACLLogCmd) NoRetry added in v9.19.0

func (cmd *ACLLogCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*ACLLogCmd) Result added in v9.0.5

func (cmd *ACLLogCmd) Result() ([]*ACLLogEntry, error)

func (*ACLLogCmd) SetErr added in v9.0.5

func (cmd *ACLLogCmd) SetErr(e error)

func (*ACLLogCmd) SetFirstKeyPos added in v9.0.5

func (cmd *ACLLogCmd) SetFirstKeyPos(keyPos int8)

func (*ACLLogCmd) SetStepCount added in v9.18.0

func (cmd *ACLLogCmd) SetStepCount(stepCount int8)

func (*ACLLogCmd) SetVal added in v9.0.5

func (cmd *ACLLogCmd) SetVal(val []*ACLLogEntry)

func (*ACLLogCmd) String added in v9.0.5

func (cmd *ACLLogCmd) String() string

func (*ACLLogCmd) Val added in v9.0.5

func (cmd *ACLLogCmd) Val() []*ACLLogEntry

type ACLLogEntry added in v9.0.5

type ACLLogEntry struct {
	Count                int64
	Reason               string
	Context              string
	Object               string
	Username             string
	AgeSeconds           float64
	ClientInfo           *ClientInfo
	EntryID              int64
	TimestampCreated     int64
	TimestampLastUpdated int64
}

type AREntry added in v9.20.0

type AREntry struct {
	Index uint64
	Value string
}

AREntry represents an index-value pair for ARMSET.

type AREntrySliceCmd added in v9.20.0

type AREntrySliceCmd struct {
	// contains filtered or unexported fields
}

AREntrySliceCmd is a command that returns index-value pairs from ARSCAN or ARGREP.

func NewAREntrySliceCmd added in v9.20.0

func NewAREntrySliceCmd(ctx context.Context, args ...any) *AREntrySliceCmd

func (*AREntrySliceCmd) Args added in v9.20.0

func (cmd *AREntrySliceCmd) Args() []interface{}

func (*AREntrySliceCmd) Clone added in v9.20.0

func (cmd *AREntrySliceCmd) Clone() Cmder

func (*AREntrySliceCmd) Err added in v9.20.0

func (cmd *AREntrySliceCmd) Err() error

func (*AREntrySliceCmd) FullName added in v9.20.0

func (cmd *AREntrySliceCmd) FullName() string

func (*AREntrySliceCmd) GetCmdType added in v9.20.0

func (cmd *AREntrySliceCmd) GetCmdType() CmdType

func (*AREntrySliceCmd) Name added in v9.20.0

func (cmd *AREntrySliceCmd) Name() string

func (*AREntrySliceCmd) NoRetry added in v9.20.0

func (cmd *AREntrySliceCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*AREntrySliceCmd) Result added in v9.20.0

func (cmd *AREntrySliceCmd) Result() ([]AREntry, error)

func (*AREntrySliceCmd) SetErr added in v9.20.0

func (cmd *AREntrySliceCmd) SetErr(e error)

func (*AREntrySliceCmd) SetFirstKeyPos added in v9.20.0

func (cmd *AREntrySliceCmd) SetFirstKeyPos(keyPos int8)

func (*AREntrySliceCmd) SetStepCount added in v9.20.0

func (cmd *AREntrySliceCmd) SetStepCount(stepCount int8)

func (*AREntrySliceCmd) SetVal added in v9.20.0

func (cmd *AREntrySliceCmd) SetVal(val []AREntry)

func (*AREntrySliceCmd) String added in v9.20.0

func (cmd *AREntrySliceCmd) String() string

func (*AREntrySliceCmd) Val added in v9.20.0

func (cmd *AREntrySliceCmd) Val() []AREntry

type ARGrepArgs added in v9.20.0

type ARGrepArgs struct {
	Predicates []ARGrepPredicate
	CombineAnd bool
	Limit      uint64
	NoCase     bool
}

ARGrepArgs contains optional arguments for ARGREP. Redis ARGREP defaults to OR when multiple predicates are given. Set CombineAnd to true to combine predicates with AND instead.

func (*ARGrepArgs) Append added in v9.20.0

func (args *ARGrepArgs) Append(a []any) []any

func (*ARGrepArgs) Len added in v9.20.0

func (args *ARGrepArgs) Len() int

type ARGrepPredicate added in v9.20.0

type ARGrepPredicate struct {
	Type  ARGrepPredicateType
	Value string
}

ARGrepPredicate represents a search predicate for ARGREP.

type ARGrepPredicateType added in v9.20.0

type ARGrepPredicateType string

ARGrepPredicateType defines the type of predicate for ARGREP.

const (
	ARGrepExact ARGrepPredicateType = "EXACT"
	ARGrepMatch ARGrepPredicateType = "MATCH"
	ARGrepGlob  ARGrepPredicateType = "GLOB"
	ARGrepRegex ARGrepPredicateType = "RE"
)

type ARRange added in v9.20.0

type ARRange struct {
	Start uint64
	End   uint64
}

ARRange represents a start-end range for ARDELRANGE.

type ARScanArgs added in v9.20.0

type ARScanArgs struct {
	Limit uint64
}

ARScanArgs contains optional arguments for ARSCAN.

type AggregateBuilder added in v9.12.0

type AggregateBuilder struct {
	// contains filtered or unexported fields
}

func (*AggregateBuilder) AddScores added in v9.12.0

func (b *AggregateBuilder) AddScores() *AggregateBuilder

AddScores includes ADDSCORES.

func (*AggregateBuilder) Apply added in v9.12.0

func (b *AggregateBuilder) Apply(field string, alias ...string) *AggregateBuilder

Apply adds an APPLY <field> [AS alias] step.

func (*AggregateBuilder) Collect added in v9.22.0

Collect adds a REDUCE COLLECT clause to the last step, which must be a GROUPBY. The COLLECT options (FIELDS/DISTINCT/SORTBY/LIMIT/AS) are rendered and the argument count is computed automatically; field and sort names are normalized to a single "@" prefix. Set FTAggregateCollect.As to alias the output column.

If the last step is not a GROUPBY, or the options are invalid (no FIELDS selector), Run returns the recorded error without issuing the command. COLLECT requires Redis 8.8+ with unstable features enabled.

func (*AggregateBuilder) Dialect added in v9.12.0

func (b *AggregateBuilder) Dialect(version int) *AggregateBuilder

Dialect sets DIALECT <version>.

func (*AggregateBuilder) Filter added in v9.12.0

func (b *AggregateBuilder) Filter(expr string) *AggregateBuilder

Filter sets FILTER <expr>.

func (*AggregateBuilder) GroupBy added in v9.12.0

func (b *AggregateBuilder) GroupBy(fields ...interface{}) *AggregateBuilder

GroupBy adds a new GROUPBY <fields...> step.

func (*AggregateBuilder) Load added in v9.12.0

func (b *AggregateBuilder) Load(field string, alias ...string) *AggregateBuilder

Load adds a LOAD <field> [AS alias] step. You can call it multiple times; each call becomes a separate LOAD clause at its position in the pipeline.

func (*AggregateBuilder) LoadAll added in v9.12.0

func (b *AggregateBuilder) LoadAll() *AggregateBuilder

LoadAll includes LOAD * (mutually exclusive with Load).

func (*AggregateBuilder) Params added in v9.12.0

func (b *AggregateBuilder) Params(p map[string]interface{}) *AggregateBuilder

Params adds PARAMS <k v> pairs.

func (*AggregateBuilder) Reduce added in v9.12.0

func (b *AggregateBuilder) Reduce(fn SearchAggregator, args ...interface{}) *AggregateBuilder

Reduce adds a REDUCE <fn> [<#args> <args...>] clause to the last step, which must be a GROUPBY. If it is not, Run will return an error.

func (*AggregateBuilder) ReduceAs added in v9.12.0

func (b *AggregateBuilder) ReduceAs(fn SearchAggregator, alias string, args ...interface{}) *AggregateBuilder

ReduceAs does the same but also sets an alias: REDUCE <fn> … AS <alias>. The last step must be a GROUPBY; otherwise Run will return an error.

func (*AggregateBuilder) Run added in v9.12.0

Run executes FT.AGGREGATE and returns a typed result. If the builder recorded a validation error while constructing the pipeline (for example, calling SortByMax when the last step is not a SortBy), that error is returned without issuing the command.

func (*AggregateBuilder) Scorer added in v9.12.0

Scorer sets SCORER <scorer>.

func (*AggregateBuilder) SortBy added in v9.12.0

func (b *AggregateBuilder) SortBy(field string, asc bool) *AggregateBuilder

SortBy adds SORTBY <field> ASC|DESC. Consecutive SortBy calls (with no other step in between) are merged into a single SORTBY clause so fields act as tiebreakers. A SortBy call after a non-SortBy step starts a new SORTBY step.

Note: this is a semantics change from earlier experimental versions of the builder, where SortBy always accumulated into a single SORTBY clause regardless of position in the pipeline.

func (*AggregateBuilder) SortByMax added in v9.12.0

func (b *AggregateBuilder) SortByMax(max int) *AggregateBuilder

SortByMax sets MAX <n> on the last SORTBY step. The last step must be a SORTBY; otherwise Run will return an error.

func (*AggregateBuilder) Timeout added in v9.12.0

func (b *AggregateBuilder) Timeout(ms int) *AggregateBuilder

Timeout sets TIMEOUT <ms>.

func (*AggregateBuilder) Verbatim added in v9.12.0

func (b *AggregateBuilder) Verbatim() *AggregateBuilder

Verbatim includes VERBATIM.

func (*AggregateBuilder) WithCursor added in v9.12.0

func (b *AggregateBuilder) WithCursor(count, maxIdle int) *AggregateBuilder

WithCursor enables WITHCURSOR [COUNT <n>] [MAXIDLE <ms>].

type AggregateCmd added in v9.5.4

type AggregateCmd struct {
	// contains filtered or unexported fields
}

func NewAggregateCmd added in v9.5.4

func NewAggregateCmd(ctx context.Context, args ...interface{}) *AggregateCmd

func (*AggregateCmd) Args added in v9.5.4

func (cmd *AggregateCmd) Args() []interface{}

func (*AggregateCmd) Clone added in v9.18.0

func (cmd *AggregateCmd) Clone() Cmder

func (*AggregateCmd) Err added in v9.5.4

func (cmd *AggregateCmd) Err() error

func (*AggregateCmd) FullName added in v9.5.4

func (cmd *AggregateCmd) FullName() string

func (*AggregateCmd) GetCmdType added in v9.18.0

func (cmd *AggregateCmd) GetCmdType() CmdType

func (*AggregateCmd) Name added in v9.5.4

func (cmd *AggregateCmd) Name() string

func (*AggregateCmd) NoRetry added in v9.19.0

func (cmd *AggregateCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*AggregateCmd) RawResult added in v9.7.0

func (cmd *AggregateCmd) RawResult() (interface{}, error)

func (*AggregateCmd) RawVal added in v9.7.0

func (cmd *AggregateCmd) RawVal() interface{}

func (*AggregateCmd) Result added in v9.5.4

func (cmd *AggregateCmd) Result() (*FTAggregateResult, error)

func (*AggregateCmd) SetErr added in v9.5.4

func (cmd *AggregateCmd) SetErr(e error)

func (*AggregateCmd) SetFirstKeyPos added in v9.5.4

func (cmd *AggregateCmd) SetFirstKeyPos(keyPos int8)

func (*AggregateCmd) SetStepCount added in v9.18.0

func (cmd *AggregateCmd) SetStepCount(stepCount int8)

func (*AggregateCmd) SetVal added in v9.5.4

func (cmd *AggregateCmd) SetVal(val *FTAggregateResult)

func (*AggregateCmd) String added in v9.5.4

func (cmd *AggregateCmd) String() string

func (*AggregateCmd) Val added in v9.5.4

func (cmd *AggregateCmd) Val() *FTAggregateResult

type AggregateQuery added in v9.5.4

type AggregateQuery []interface{}

func FTAggregateQuery added in v9.5.4

func FTAggregateQuery(query string, options *FTAggregateOptions) (AggregateQuery, error)

type AggregateRow added in v9.5.4

type AggregateRow struct {
	Fields map[string]interface{}
}

func (AggregateRow) Collect added in v9.22.0

func (r AggregateRow) Collect(alias string) (CollectColumn, error)

Collect decodes the COLLECT reducer column stored under alias in this row into a uniform CollectColumn, hiding the RESP2/RESP3 representation difference (RESP3 entries are maps; RESP2 entries are flat key/value arrays).

It returns (nil, nil) when the alias is absent from the row. Entry order is preserved as returned by the server; it is meaningful only when the COLLECT reducer was given a SORTBY.

type Aggregator added in v9.2.0

type Aggregator int

func (Aggregator) String added in v9.2.0

func (a Aggregator) String() string

type AliasBuilder added in v9.12.0

type AliasBuilder struct {
	// contains filtered or unexported fields
}

---------------------- AliasBuilder for FT.ALIAS* commands ---------------------- AliasBuilder is builder for FT.ALIAS* commands EXPERIMENTAL: this API is subject to change, use with caution.

func (*AliasBuilder) Action added in v9.12.0

func (b *AliasBuilder) Action(action string) *AliasBuilder

Action sets the action for the alias builder.

func (*AliasBuilder) Add added in v9.12.0

func (b *AliasBuilder) Add(index string) *AliasBuilder

Add sets the action to "add" and requires an index.

func (*AliasBuilder) Del added in v9.12.0

func (b *AliasBuilder) Del() *AliasBuilder

Del sets the action to "del".

func (*AliasBuilder) Run added in v9.12.0

func (b *AliasBuilder) Run() (string, error)

Run executes the configured alias command.

func (*AliasBuilder) Update added in v9.12.0

func (b *AliasBuilder) Update(index string) *AliasBuilder

Update sets the action to "update" and requires an index.

type ArrayCmdable added in v9.20.0

type ArrayCmdable interface {
	ARSet(ctx context.Context, key string, index uint64, values ...string) *IntCmd
	ARGet(ctx context.Context, key string, index uint64) *StringCmd
	ARGetRange(ctx context.Context, key string, start, end uint64) *SliceCmd
	ARMGet(ctx context.Context, key string, indexes ...uint64) *SliceCmd
	ARMSet(ctx context.Context, key string, members ...AREntry) *IntCmd
	ARInsert(ctx context.Context, key string, values ...string) *UintCmd
	ARDel(ctx context.Context, key string, indexes ...uint64) *IntCmd
	ARDelRange(ctx context.Context, key string, ranges ...ARRange) *UintCmd
	ARLen(ctx context.Context, key string) *UintCmd
	ARCount(ctx context.Context, key string) *UintCmd
	ARNext(ctx context.Context, key string) *UintCmd
	ARSeek(ctx context.Context, key string, index uint64) *IntCmd
	ARInfo(ctx context.Context, key string) *MapStringInterfaceCmd
	ARInfoFull(ctx context.Context, key string) *MapStringInterfaceCmd
	ARScan(ctx context.Context, key string, start, end uint64, args *ARScanArgs) *AREntrySliceCmd
	AROpSum(ctx context.Context, key string, start, end uint64) *StringCmd
	AROpMin(ctx context.Context, key string, start, end uint64) *StringCmd
	AROpMax(ctx context.Context, key string, start, end uint64) *StringCmd
	AROpAnd(ctx context.Context, key string, start, end uint64) *IntCmd
	AROpOr(ctx context.Context, key string, start, end uint64) *IntCmd
	AROpXor(ctx context.Context, key string, start, end uint64) *IntCmd
	AROpMatch(ctx context.Context, key string, start, end uint64, value string) *IntCmd
	AROpUsed(ctx context.Context, key string, start, end uint64) *IntCmd
	ARGrep(ctx context.Context, key string, start, end string, args *ARGrepArgs) *UintSliceCmd
	ARGrepWithValues(ctx context.Context, key string, start, end string, args *ARGrepArgs) *AREntrySliceCmd
	ARRing(ctx context.Context, key string, size uint64, values ...string) *UintCmd
	ARLastItems(ctx context.Context, key string, count uint64, rev bool) *SliceCmd
}

note: the APIs is experimental and may be subject to change.

ArrayCmdable defines the interface for Redis Array data structure commands available in Redis 8.8.0+.

Redis array supports index range [0, math.MaxUint64-1), so index parameters use uint64.

type AutoFuture added in v9.22.0

type AutoFuture struct {
	// contains filtered or unexported fields
}

AutoFuture is the handle returned by Submit. Call Wait (or Result on the command after Wait) once the result is needed; it blocks only until the command's batch has executed.

func (AutoFuture) Cmd added in v9.22.0

func (f AutoFuture) Cmd() Cmder

Cmd returns the underlying command (call Wait first before reading results).

func (AutoFuture) Wait added in v9.22.0

func (f AutoFuture) Wait() error

Wait blocks until the submitted command has executed, then returns its error. The zero AutoFuture (no submitted command) returns an error rather than panicking.

func (AutoFuture) WaitContext added in v9.22.0

func (f AutoFuture) WaitContext(ctx context.Context) error

WaitContext is like Wait but stops waiting when ctx is done. The command still executes and its result remains readable once its batch completes — ctx abandons only this wait, it does not cancel the command (per-command contexts are not honored after enqueue; see the AutoPipeliner doc).

After a ctx error the result may simply not be there YET: the batch is still in flight and may populate the command at any moment, so do not read Cmd()'s value or error directly — that races the executing batch. Call Wait (or WaitContext with a fresh context) again; once it returns a non-context error, the command's result is complete and safe to read.

type AutoPipelineOptions added in v9.22.0

type AutoPipelineOptions struct {
	// MaxBatchSize is the target batch size: the accumulator stops waiting for
	// more commands once the shard queue reaches it, so a batch flushes promptly
	// instead of lingering. It is a soft threshold, not a hard cap — under heavy
	// concurrent enqueue (or while a flush waits on the concurrency semaphore) the
	// queue can grow past it and execute as a single larger pipeline, which is
	// safe and simply yields a deeper pipeline.
	// Default: 200 (the blocking face's no-options preset,
	// DefaultBlockingAutoPipelineOptions, uses 300).
	MaxBatchSize int

	// MaxBatchBytes caps a batch by APPROXIMATE payload volume: the
	// accumulator stops waiting once the queued commands' argument bytes reach
	// it, so many large values flush as several bounded writes instead of one
	// huge burst (300 x 64KiB is ~19MB written down one connection before any
	// reply is read — enough to stall a constrained link past its write
	// deadline). Like MaxBatchSize it is a soft threshold, not a hard cap.
	// The estimate sizes string, []byte, *string and BinaryMarshaler arguments
	// by their encoded length (other argument kinds by a small fixed size) plus
	// a small per-argument overhead.
	//
	// Default: 128 KiB. Only 0 selects the default; a negative value is
	// rejected by Validate rather than silently coerced (the autopipeliner
	// getters return that error). There is no "unbounded" setting — pass a
	// deliberately large value instead. This is a
	// full-duplex safety guardrail, not a throughput knob: with FullDuplex,
	// the reader cannot start draining replies until the writer finishes
	// flushing the WHOLE batch (see autopipeline_fullduplex.go), so a batch
	// with ≥2 large-payload commands can deadlock both directions — Redis
	// blocks writing an early large reply while the client is still blocked
	// writing the rest of the batch, resolved only by WriteTimeout, and
	// recovery may then replay a command Redis already executed (cursor/codex
	// on #4002). The cap bounds this for large-REQUEST commands (big ECHO,
	// large SET values); it does NOT bound expected REPLY size, so a batch of
	// plain GETs against large values is still exposed regardless of this
	// setting — closing that gap needs the reader to drain incrementally, not
	// a byte cap. For ordinary small commands this default rarely binds:
	// MaxBatchSize's 200-command cap already keeps a typical batch under
	// ~15 KiB, far below this threshold.
	MaxBatchBytes int

	// MaxConcurrentBatches is the maximum number of pipeline batches that may
	// execute concurrently.
	//
	// Default: 1, which gives a single ordered command stream — batches execute
	// serially in submit order, so even a windowed caller (submit many, read
	// later) sees strict ordering, while still reaching high throughput via deep
	// pipelines (~3M ops/sec locally).
	//
	// Setting this above 1 runs batches in parallel for maximum throughput, but
	// commands then have NO guaranteed execution order. Because that trades away
	// ordering, it is only allowed together with Unordered: true — otherwise the
	// configuration is rejected (see Validate). This makes the trade-off
	// explicit: you cannot accidentally lose ordering by raising concurrency.
	MaxConcurrentBatches int

	// Unordered must be set to true to allow MaxConcurrentBatches > 1. It is the
	// caller's explicit acknowledgement that parallel batch execution gives up
	// command ordering in exchange for throughput. With the default (false),
	// MaxConcurrentBatches is forced to 1 (an ordered stream) and any value > 1
	// is a configuration error.
	Unordered bool

	// FullDuplex enables the ordered full-duplex dispatch path: one held
	// pipeline-pool connection with a writer+reader goroutine pair streaming the
	// ordered command stream, instead of the half-duplex one-batch-per-round-trip
	// flusher. Its win is a latency-bound (WAN) link under many concurrent
	// goroutines: ~1 RTT latency and pipe-saturated throughput on a single
	// connection. On a fast link (loopback) prefer half-duplex — with no RTT to
	// overlap, full-duplex only adds coordination overhead.
	//
	// Also honored by the full-duplex writer, where it is gated on in-flight
	// depth so it never taxes low-concurrency callers (see fdAccumMinFor).
	//
	// Honored on the ordered (Unordered:false, MaxConcurrentBatches<=1) face of a
	// standalone *Client that has a pipeline pool — BOTH the deferred
	// (AsyncAutoPipeline) and the blocking (AutoPipeline) face. NumShards > 1
	// runs that many full-duplex engines, each on its own held connection; see
	// NumShards for the ordering that mode keeps. A SINGLE
	// blocking caller gains nothing: it has one command in flight, so there is
	// nothing to overlap, and it still pays the held connection and goroutine
	// overhead; the win needs MANY concurrent blocking callers, whose commands then
	// overlap on the shared pipe exactly as on the async face (~1 RTT each instead
	// of batch phase-locking). On a ClusterClient it runs natively per node: the
	// engine keeps one FD child per master (each on that node's node.Client, which
	// has a pipeline pool by default) and routes each command to the child that
	// owns its slot; MOVED/ASK redirects are followed through the redirect-aware
	// cluster path (topology reload included). It falls back to half-duplex only
	// when PipelinePoolSize<0 removes the node pipeline pools. Validate rejects the
	// contradictory standalone combos (FullDuplex with Unordered or MaxConcurrentBatches>1).
	//
	// Ordering caveat: blocking and connection-hostile commands (BLPOP, WAIT,
	// XREAD BLOCK, SUBSCRIBE, MULTI, ...) are diverted to a separate pooled
	// connection so they cannot stall the shared pipe. Managed HIMPORT
	// (PREPARE/SET/DISCARD/DISCARDALL) is diverted too, but only on the full-duplex
	// path: a fieldset is connection-session state that the FD writer does not
	// replay and the FD reader does not track, so it runs through the normal Process
	// path — which injects the registered PREPARE and keeps the registry current —
	// instead of failing with "no such fieldset". A reply that is a retryable Redis
	// error (LOADING/READONLY/…) is likewise re-run through Process, off the FD
	// reader, so the reader keeps completing later replies. A MOVED/ASK redirect is
	// NOT replayed on the standalone full-duplex path — a standalone Client cannot
	// route it — so the redirect surfaces to the caller as the command's error,
	// exactly as it does for a plain standalone command (a cluster-aware FD path
	// could route it instead; that is a follow-up). Per-caller ordering therefore
	// does NOT hold across a diverted command: it may settle AFTER a command
	// submitted later on the same goroutine.
	// That reorders only a caller holding TWO causally-dependent commands in flight
	// WITHOUT awaiting the first (e.g. Set(k) then Get(k) both fired on the async
	// face before reading Set's result); awaiting a result before issuing a
	// dependent one preserves order, and the blocking face waits per command by
	// construction, so its per-goroutine ordering is unaffected. NoRetry commands
	// are never diverted. Half-duplex diverts identically; blocking commands were
	// never part of the ordered stream.
	//
	// Observability: process hooks (redisotel spans/metrics, custom AddHook
	// ProcessHooks) DO fire on the full-duplex path — each command runs the hook
	// chain individually (withProcessHook, not the batch ProcessPipelineHook), the
	// span bracketing its real write→reply latency; with none registered the hosting
	// is skipped entirely (the fast path). Presence is checked per command at submit
	// time, so a hook registered via AddHook is observed only by commands submitted
	// after it (one already in flight is not retroactively spanned). DialHook and
	// pool stats work as usual. Caveat: the write is already queued on the shared
	// stream when the hook host starts, so a hook that SHORT-CIRCUITS (returns
	// without calling next) does NOT cancel execution — the command still runs on
	// the wire and only the hook's returned error reaches the caller, unlike the
	// half-duplex path where next() gates the write. A hook that relies on
	// short-circuiting to BLOCK a command (a policy/ACL/kill-switch hook, or a
	// mock/cache that must not touch the server) therefore does NOT prevent the
	// server write under FullDuplex — run such hooks on a plain client or the
	// half-duplex autopipeline. A hook that calls next and only OBSERVES the
	// command (reads its result after next, optionally rewriting the returned
	// error) is unaffected. But because the write is already queued when the host
	// starts, a hook MUST NOT mutate the command — e.g. cmd.Args() — set its
	// result, or READ its result (cmd.Err(), cmd.Val(), cmd.String(), ...)
	// BEFORE calling next: the write is already queued and the reader may be
	// completing the command concurrently. On the hook-host goroutine the result
	// accessors do not block (it is the batch's executor; blocking there would
	// self-deadlock — see await), so a pre-next read is the not-yet-executed view
	// racing the reader's write, not a wait for the result. Read results only
	// after next returns. Mutate-before-next hooks must run on a plain client or
	// the half-duplex autopipeline, where next() gates the write.
	//
	// A ProcessHook MUST NOT synchronously call Close (Client.Close or
	// AutoPipeliner.Close) from inside the hook: the hook runs on the full-duplex
	// hook-host goroutine and Close waits for that goroutine to finish, so a
	// synchronous Close from the hook deadlocks until the close backstop (~30s).
	// Trigger Close from a separate goroutine if a hook must initiate it.
	//
	// TODO(fullduplex): offer opt-in write-gating for blocking hooks — a per-client
	// or per-command flag that waits for the hook to call next before enqueuing the
	// command onto fd.ch, so a policy hook can veto the write, at the cost of the
	// ~1-RTT concurrency for gated commands (observability-only hooks keep the fast
	// path). Until then the short-circuit-does-not-block semantics above are
	// intentional, not a bug.
	//
	// Limiter: Options.Limiter is admitted (Allow/ReportResult) once PER WRITTEN
	// BATCH — the chunk flushed to the connection in one write, the full-duplex
	// analogue of a pipeline exec or a half-duplex flush — not per command and
	// not per session. A deny fails every command of that chunk with the
	// Limiter's own error, verbatim (examinable via errors.Is); the session and
	// its connection stay alive, and the next chunk pays Allow again, so an open
	// breaker fail-fasts and service resumes as soon as it closes. Because
	// admission happens at write time, a deny surfaces as queue latency on the
	// awaited result, not as a submit-time error — and one deny covers a whole
	// chunk, exactly as one Allow covers a whole pipeline exec elsewhere.
	// ReportResult fires exactly once per admitted chunk, strictly paired with its
	// Allow, and carries the REPLY-side outcome — not the write result. A clean write
	// does NOT report at admission: the obligation rides the in-flight deque on the
	// chunk's last command and reports nil once every reply of the chunk has landed
	// (reply-LEVEL errors such as redis.Nil / WRONGTYPE / MOVED still report nil — a
	// server that answers is healthy). A write failure or encoder panic reports that
	// write error immediately (the replies will never come); a later transport failure
	// that abandons the chunk's unread replies reports that error. A denied (or
	// panicking) Allow grants no permit and reports nothing. So a custom Limiter must
	// expect its permit to be released on the reply side and to observe only transport
	// failures, never reply-level Redis errors.
	FullDuplex bool

	// FullDuplexWindow is the maximum in-flight (written-but-unacknowledged)
	// commands before the writer applies backpressure — a hard memory bound AND the
	// cap on how deep the pipe can fill, so it must exceed the bandwidth-delay
	// product (RTT × target rate) or it throttles throughput. The deque holds only
	// ACTUAL in-flight (self-limited by throughput), so a generous window costs no
	// memory until a stalled peer makes in-flight grow. Only used when FullDuplex is
	// set; 0 means the default (65536, covering ~50ms links at ~1.3M ops/s) and a
	// negative value is rejected by Validate.
	//
	// The window is PER ENGINE. With NumShards > 1 each full-duplex engine gets
	// its own window and submit queue of this size, so the client-wide bound is
	// NumShards × FullDuplexWindow in flight, plus as many queued. Size it for
	// one wire; to cap the total, divide by NumShards.
	FullDuplexWindow int

	// FullDuplexIdleTimeout is how long the held full-duplex connection may sit
	// with no queued work and a drained in-flight before it is returned to the pool
	// (so it is reusable and its per-conn hooks — streaming-creds re-auth,
	// maintnotifications — get a chance to run). Only used when FullDuplex is set.
	// 0 means the default (1s); a negative value is rejected by Validate.
	FullDuplexIdleTimeout time.Duration

	// FullDuplexMaxHold forces the same clean return under continuous load, so the
	// per-conn hooks run at least this often even when the connection never goes
	// idle. Only used when FullDuplex is set. 0 means the default (5s); a negative
	// value is rejected by Validate.
	FullDuplexMaxHold time.Duration

	// NumShards is the number of independent queue+flusher shards the
	// autopipeliner runs. 0 (the default) means auto: a single shard, which
	// funnels every caller into one queue so batches stay deep — measured
	// throughput and latency are best with one shard even under heavy
	// goroutine concurrency. Cluster clients default to several slot-routed
	// shards instead, so commands for different nodes queue independently
	// (per-key order still holds: a key's slot always maps to the same
	// shard). Raising NumShards splits the queue: it reduces enqueue-mutex
	// contention but fragments batches, which usually costs far more than the
	// contention saves. Every shard always has at least one concurrency
	// permit, so the effective global batch concurrency is
	// max(NumShards, MaxConcurrentBatches) — and because shards flush
	// concurrently, NumShards > 1 on the deferred (async) face requires
	// Unordered: true (construction fails otherwise).
	//
	// With FullDuplex active on a standalone *Client, NumShards means something
	// else: the number of full-duplex engines, each holding one pipeline-pool
	// connection with its own window (see FullDuplexWindow). More engines pay
	// off only with many concurrent callers: measured with 10-command
	// pipelines, 8 engines were 30% slower than 1 at 8 callers, broke even at about
	// 128, and 2.2x faster at 1024. Commands are routed
	// to an engine by a hash of their first key, so Unordered is not required,
	// but order holds only between commands that share a first key. The key is
	// hashed in its string form (fmt for non-string arguments, as Ring does), so
	// pass a key as the same Go type everywhere: true and "1" are the same Redis
	// key but can land on different engines. Commands
	// that touch other keys after the first one (COPY, RENAME, MSET, multi-key
	// DEL, EVAL/FCALL with several keys) and keyless commands (including
	// FLUSHDB and SWAPDB) are not ordered against the rest; await the first
	// future before submitting a dependent one, or keep NumShards at 1, which
	// keeps the whole submit order. A Pipeline() rides the FD wire only when all
	// its keyed commands hash to one engine; otherwise it runs as an ordinary
	// pipeline on a pooled connection, not ordered against unawaited commands on
	// the engines. The pipeline pool must hold at least
	// NumShards connections for every full-duplex autopipeliner in use
	// (construction checks this one). If full duplex cannot engage (no
	// pipeline pool), the Unordered rule above applies.
	NumShards int

	// MaxFlushDelay is the maximum delay after flushing before checking for more commands.
	// A small delay (e.g., 100μs) can significantly reduce CPU usage by allowing
	// more commands to batch together, at the cost of slightly higher latency.
	//
	// Trade-off:
	// - 0 (default): Lowest latency, higher CPU usage
	// - 100μs: Balanced (recommended for most workloads)
	// - 500μs: Lower CPU usage, higher latency
	//
	// Based on benchmarks, 100μs can reduce CPU usage by 50%
	// while adding only ~100μs average latency per command.
	// Default: 0, meaning the flusher applies no coalescing wait — it flushes
	// each batch as soon as the queue is ready and lets in-flight backpressure
	// coalesce concurrent callers (see accumulateBatch). Set a value here to add
	// an explicit accumulation window, trading latency for larger batches / less
	// CPU as described above.
	MaxFlushDelay time.Duration

	// AdaptiveDelay enables smart delay calculation based on queue fill level.
	// When enabled, the delay is automatically adjusted:
	// - Queue ≥75% full: No delay (flush immediately to prevent overflow)
	// - Queue ≥50% full: 25% of MaxFlushDelay (queue filling up)
	// - Queue ≥25% full: 50% of MaxFlushDelay (moderate load)
	// - Queue <25% full: 100% of MaxFlushDelay (low load, maximize batching)
	//
	// This provides automatic adaptation to varying load patterns without
	// manual tuning. Uses integer-only arithmetic for optimal performance.
	// Default: false (use fixed MaxFlushDelay)
	//
	// Half-duplex only. The full-duplex writer has its own policy: it waits
	// MaxFlushDelay only when enough commands are in flight (see MaxFlushDelay)
	// and ignores AdaptiveDelay.
	AdaptiveDelay bool

	// MaxQueuedCommands, when > 0, is a hard limit on commands the
	// autopipeliner has accepted but not yet completed: queued, waiting for a
	// batch permit, executing, and commands run outside the pipeline (Do,
	// blocking and connection-hostile commands). A command submitted at the limit is not
	// queued: it fails at once with ErrAutoPipelineQueueFull. The limit bounds
	// client memory when the server is slower than the producers.
	//
	// Rejection is per command, so it can break submit order on the deferred
	// face: a SET may be rejected while a later GET on the same key is
	// accepted. Check the error of each command that the next one depends on.
	//
	// With FullDuplex the ordered stream is bounded by FullDuplexWindow (a full
	// window blocks the submitter instead of rejecting), so MaxQueuedCommands
	// then limits only the commands run outside the pipeline.
	// Default: 0 (no limit).
	MaxQueuedCommands int
	// contains filtered or unexported fields
}

AutoPipelineOptions configures the autopipelining behavior.

EXPERIMENTAL: this API is subject to change, use with caution.

func DefaultAutoPipelineOptions added in v9.22.0

func DefaultAutoPipelineOptions() *AutoPipelineOptions

DefaultAutoPipelineOptions returns the default autopipelining configuration.

The default is ordered: MaxConcurrentBatches is 1, so batches execute serially in submit order (a single ordered command stream) while still reaching high throughput via deep pipelines when callers submit in windows. To trade ordering for parallel-batch throughput, set MaxConcurrentBatches > 1 together with Unordered: true.

EXPERIMENTAL: this API is subject to change, use with caution.

func DefaultBlockingAutoPipelineOptions added in v9.22.0

func DefaultBlockingAutoPipelineOptions() *AutoPipelineOptions

DefaultBlockingAutoPipelineOptions returns the default config for the blocking face (Client.AutoPipeline). It uses a single ordered batch stream (MaxConcurrentBatches: 1). Counterintuitively this maximizes throughput AND minimizes latency for the blocking face: with one batch in flight, callers whose commands return while it executes re-enqueue and flush together as the next batch, so batches stay deep (a near-continuous, double-buffered pipeline), while a lone caller flushes promptly in a single round-trip (no coalescing wait — see accumulateBatch). More parallel permits (MaxConcurrentBatches>1) do the opposite: each command finds a free permit and flushes on its own before others accumulate, collapsing batch size — and throughput — toward one command per round-trip while latency rises. For maximum throughput use the async face (AsyncAutoPipeline) with a window of in-flight commands (inflight>1); it keeps MaxConcurrentBatches: 1 as well.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*AutoPipelineOptions) Validate added in v9.22.0

func (cfg *AutoPipelineOptions) Validate() error

Validate reports whether the configuration is self-consistent. It returns an error if MaxConcurrentBatches > 1 without Unordered: true — raising concurrency gives up command ordering, so the caller must opt in explicitly.

Validate()==nil does not guarantee construction succeeds: rules that need the face (e.g. NumShards>1 requires Unordered on the deferred face) are enforced by the AutoPipeline/AsyncAutoPipeline getters. Note also that Options.AutoPipelineOptions is validated lazily — on the first getter call, not in NewClient.

type AutoPipeliner added in v9.22.0

type AutoPipeliner struct {
	// contains filtered or unexported fields
}

func (AutoPipeliner) ACLCat added in v9.22.0

func (c AutoPipeliner) ACLCat(ctx context.Context) *StringSliceCmd

func (AutoPipeliner) ACLCatArgs added in v9.22.0

func (c AutoPipeliner) ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd

func (AutoPipeliner) ACLDelUser added in v9.22.0

func (c AutoPipeliner) ACLDelUser(ctx context.Context, username string) *IntCmd

func (AutoPipeliner) ACLDryRun added in v9.22.0

func (c AutoPipeliner) ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd

func (AutoPipeliner) ACLGenPass added in v9.22.0

func (c AutoPipeliner) ACLGenPass(ctx context.Context, bit int) *StringCmd

func (AutoPipeliner) ACLList added in v9.22.0

func (c AutoPipeliner) ACLList(ctx context.Context) *StringSliceCmd

func (AutoPipeliner) ACLLog added in v9.22.0

func (c AutoPipeliner) ACLLog(ctx context.Context, count int64) *ACLLogCmd

func (AutoPipeliner) ACLLogReset added in v9.22.0

func (c AutoPipeliner) ACLLogReset(ctx context.Context) *StatusCmd

func (AutoPipeliner) ACLSetUser added in v9.22.0

func (c AutoPipeliner) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd

func (AutoPipeliner) ACLUsers added in v9.22.0

func (c AutoPipeliner) ACLUsers(ctx context.Context) *StringSliceCmd

func (AutoPipeliner) ACLWhoAmI added in v9.22.0

func (c AutoPipeliner) ACLWhoAmI(ctx context.Context) *StringCmd

func (AutoPipeliner) ARCount added in v9.22.0

func (c AutoPipeliner) ARCount(ctx context.Context, key string) *UintCmd

ARCount returns the number of non-empty elements in an array. Returns 0 if the key does not exist.

func (AutoPipeliner) ARDel added in v9.22.0

func (c AutoPipeliner) ARDel(ctx context.Context, key string, indexes ...uint64) *IntCmd

ARDel deletes elements at the specified indexes in an array. Returns the number of elements deleted.

func (AutoPipeliner) ARDelRange added in v9.22.0

func (c AutoPipeliner) ARDelRange(ctx context.Context, key string, ranges ...ARRange) *UintCmd

ARDelRange deletes elements in one or more ranges. Returns the number of elements deleted.

func (AutoPipeliner) ARGet added in v9.22.0

func (c AutoPipeliner) ARGet(ctx context.Context, key string, index uint64) *StringCmd

ARGet gets the value at an index in an array. Returns redis.Nil if the key or index does not exist.

func (AutoPipeliner) ARGetRange added in v9.22.0

func (c AutoPipeliner) ARGetRange(ctx context.Context, key string, start, end uint64) *SliceCmd

ARGetRange gets values in a range of indexes. Returns values in the range, with nil for unset indexes.

func (AutoPipeliner) ARGrep added in v9.22.0

func (c AutoPipeliner) ARGrep(ctx context.Context, key string, start, end string, grepArgs *ARGrepArgs) *UintSliceCmd

ARGrep searches array elements in a range using textual predicates. Returns matching indexes only. Use ARGrepWithValues to also get the values.

func (AutoPipeliner) ARGrepWithValues added in v9.22.0

func (c AutoPipeliner) ARGrepWithValues(ctx context.Context, key string, start, end string, grepArgs *ARGrepArgs) *AREntrySliceCmd

ARGrepWithValues searches array elements in a range using textual predicates. Returns matching indexes and their values as index-value pairs.

func (AutoPipeliner) ARInfo added in v9.22.0

func (c AutoPipeliner) ARInfo(ctx context.Context, key string) *MapStringInterfaceCmd

ARInfo returns metadata about an array.

func (AutoPipeliner) ARInfoFull added in v9.22.0

func (c AutoPipeliner) ARInfoFull(ctx context.Context, key string) *MapStringInterfaceCmd

ARInfoFull returns detailed metadata about an array including slice statistics.

func (AutoPipeliner) ARInsert added in v9.22.0

func (c AutoPipeliner) ARInsert(ctx context.Context, key string, values ...string) *UintCmd

ARInsert inserts one or more values at consecutive indexes. Returns the last index where a value was inserted.

func (AutoPipeliner) ARLastItems added in v9.22.0

func (c AutoPipeliner) ARLastItems(ctx context.Context, key string, count uint64, rev bool) *SliceCmd

ARLastItems returns the most recently inserted elements. When rev is true, returns items in reverse order.

func (AutoPipeliner) ARLen added in v9.22.0

func (c AutoPipeliner) ARLen(ctx context.Context, key string) *UintCmd

ARLen returns the length of an array (max index + 1). Returns 0 if the key does not exist.

func (AutoPipeliner) ARMGet added in v9.22.0

func (c AutoPipeliner) ARMGet(ctx context.Context, key string, indexes ...uint64) *SliceCmd

ARMGet gets values at multiple indexes in an array. Returns values at the specified indexes, with nil for unset indexes.

func (AutoPipeliner) ARMSet added in v9.22.0

func (c AutoPipeliner) ARMSet(ctx context.Context, key string, members ...AREntry) *IntCmd

ARMSet sets multiple index-value pairs in an array. Returns the number of new slots that were set (previously empty).

func (AutoPipeliner) ARNext added in v9.22.0

func (c AutoPipeliner) ARNext(ctx context.Context, key string) *UintCmd

ARNext returns the next index ARINSERT would use. Returns 0 for missing keys or when no insert happened yet. Returns nil when the insertion cursor is exhausted / would overflow.

func (AutoPipeliner) AROpAnd added in v9.22.0

func (c AutoPipeliner) AROpAnd(ctx context.Context, key string, start, end uint64) *IntCmd

AROpAnd returns the bitwise AND of integer elements in a range.

func (AutoPipeliner) AROpMatch added in v9.22.0

func (c AutoPipeliner) AROpMatch(ctx context.Context, key string, start, end uint64, value string) *IntCmd

AROpMatch returns the count of elements matching a target string in a range.

func (AutoPipeliner) AROpMax added in v9.22.0

func (c AutoPipeliner) AROpMax(ctx context.Context, key string, start, end uint64) *StringCmd

AROpMax returns the maximum numeric element in a range.

func (AutoPipeliner) AROpMin added in v9.22.0

func (c AutoPipeliner) AROpMin(ctx context.Context, key string, start, end uint64) *StringCmd

AROpMin returns the minimum numeric element in a range.

func (AutoPipeliner) AROpOr added in v9.22.0

func (c AutoPipeliner) AROpOr(ctx context.Context, key string, start, end uint64) *IntCmd

AROpOr returns the bitwise OR of integer elements in a range.

func (AutoPipeliner) AROpSum added in v9.22.0

func (c AutoPipeliner) AROpSum(ctx context.Context, key string, start, end uint64) *StringCmd

AROpSum returns the sum of numeric elements in a range.

func (AutoPipeliner) AROpUsed added in v9.22.0

func (c AutoPipeliner) AROpUsed(ctx context.Context, key string, start, end uint64) *IntCmd

AROpUsed returns the count of non-empty slots in a range.

func (AutoPipeliner) AROpXor added in v9.22.0

func (c AutoPipeliner) AROpXor(ctx context.Context, key string, start, end uint64) *IntCmd

AROpXor returns the bitwise XOR of integer elements in a range.

func (AutoPipeliner) ARRing added in v9.22.0

func (c AutoPipeliner) ARRing(ctx context.Context, key string, size uint64, values ...string) *UintCmd

ARRing inserts values into a ring buffer of specified size, wrapping and truncating as needed. Returns the last index where a value was inserted.

func (AutoPipeliner) ARScan added in v9.22.0

func (c AutoPipeliner) ARScan(ctx context.Context, key string, start, end uint64, scanArgs *ARScanArgs) *AREntrySliceCmd

ARScan iterates existing elements in a range, returning index-value pairs.

func (AutoPipeliner) ARSeek added in v9.22.0

func (c AutoPipeliner) ARSeek(ctx context.Context, key string, index uint64) *IntCmd

ARSeek sets the ARINSERT / ARRING cursor to a specific index. Returns 1 if the cursor was set, 0 if the key does not exist.

func (AutoPipeliner) ARSet added in v9.22.0

func (c AutoPipeliner) ARSet(ctx context.Context, key string, index uint64, values ...string) *IntCmd

ARSet sets one or more contiguous values starting at an index in an array. Returns the number of new slots that were set (previously empty).

func (*AutoPipeliner) AddHook added in v9.22.0

func (ap *AutoPipeliner) AddHook(hook Hook)

AddHook adds a hook to the underlying client. Autopipelined batches are hooked too, since dispatch goes through the hook-wrapped pipeline entry.

Hook contract:

  • Short-circuiting differs by dispatch mode. In half-duplex (batched) mode a hook MAY return without calling next to skip the server — a supported pattern for a mock or cache. In full-duplex mode the command is already queued on the held connection before the hook runs, so returning without calling next does NOT prevent the server write; a hook cannot cancel a full-duplex command.
  • Do not call Close, or any other client control method, from inside a hook. A hook runs on the engine's dispatch goroutine; in full-duplex mode a synchronous Close from there blocks until the close backstop, because Close waits on the very hook host it is running on. Trigger Close from a separate goroutine (see the FullDuplex GoDoc).
  • Do not panic. A panic in a batch hook is recovered so it cannot crash the process, but the affected batch fails.
  • Do not mutate client or connection state.

func (AutoPipeliner) Append added in v9.22.0

func (c AutoPipeliner) Append(ctx context.Context, key, value string) *IntCmd

func (*AutoPipeliner) AsyncAutoPipeline added in v9.22.0

func (ap *AutoPipeliner) AsyncAutoPipeline() (*AutoPipeliner, error)

AsyncAutoPipeline delegates to the underlying client. Present to satisfy the UniversalClient surface.

func (*AutoPipeliner) AsyncAutoPipelineWithOptions added in v9.22.0

func (ap *AutoPipeliner) AsyncAutoPipelineWithOptions(config *AutoPipelineOptions) (*AutoPipeliner, error)

AsyncAutoPipelineWithOptions delegates to the underlying client.

func (*AutoPipeliner) AutoPipeline added in v9.22.0

func (ap *AutoPipeliner) AutoPipeline() (*AutoPipeliner, error)

AutoPipeline delegates to the underlying client, which returns its cached autopipeliner (typically this same instance). Present to satisfy the UniversalClient surface.

func (*AutoPipeliner) AutoPipelineWithOptions added in v9.22.0

func (ap *AutoPipeliner) AutoPipelineWithOptions(config *AutoPipelineOptions) (*AutoPipeliner, error)

AutoPipelineWithOptions delegates to the underlying client.

func (AutoPipeliner) BFAdd added in v9.22.0

func (c AutoPipeliner) BFAdd(ctx context.Context, key string, element interface{}) *BoolCmd

BFAdd adds an item to a Bloom filter. For more information - https://redis.io/commands/bf.add/

func (AutoPipeliner) BFCard added in v9.22.0

func (c AutoPipeliner) BFCard(ctx context.Context, key string) *IntCmd

BFCard returns the cardinality of a Bloom filter - number of items that were added to a Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter). For more information - https://redis.io/commands/bf.card/

func (AutoPipeliner) BFExists added in v9.22.0

func (c AutoPipeliner) BFExists(ctx context.Context, key string, element interface{}) *BoolCmd

BFExists determines whether a given item was added to a Bloom filter. For more information - https://redis.io/commands/bf.exists/

func (AutoPipeliner) BFInfo added in v9.22.0

func (c AutoPipeliner) BFInfo(ctx context.Context, key string) *BFInfoCmd

Returns information about a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInfoArg added in v9.22.0

func (c AutoPipeliner) BFInfoArg(ctx context.Context, key, option string) *BFInfoCmd

BFInfoArg returns information about a specific option of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInfoCapacity added in v9.22.0

func (c AutoPipeliner) BFInfoCapacity(ctx context.Context, key string) *BFInfoCmd

BFInfoCapacity returns information about the capacity of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInfoExpansion added in v9.22.0

func (c AutoPipeliner) BFInfoExpansion(ctx context.Context, key string) *BFInfoCmd

BFInfoExpansion returns information about the expansion rate of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInfoFilters added in v9.22.0

func (c AutoPipeliner) BFInfoFilters(ctx context.Context, key string) *BFInfoCmd

BFInfoFilters returns information about the filters of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInfoItems added in v9.22.0

func (c AutoPipeliner) BFInfoItems(ctx context.Context, key string) *BFInfoCmd

BFInfoItems returns information about the items of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInfoSize added in v9.22.0

func (c AutoPipeliner) BFInfoSize(ctx context.Context, key string) *BFInfoCmd

BFInfoSize returns information about the size of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (AutoPipeliner) BFInsert added in v9.22.0

func (c AutoPipeliner) BFInsert(ctx context.Context, key string, options *BFInsertOptions, elements ...interface{}) *BoolSliceCmd

BFInsert inserts elements into a Bloom filter. This function also allows for specifying additional options such as: capacity, error rate, expansion rate, and non-scaling behavior. For more information - https://redis.io/commands/bf.insert/

func (AutoPipeliner) BFLoadChunk added in v9.22.0

func (c AutoPipeliner) BFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd

BFLoadChunk restores a Bloom filter previously saved using BF.SCANDUMP. For more information - https://redis.io/commands/bf.loadchunk/

func (AutoPipeliner) BFMAdd added in v9.22.0

func (c AutoPipeliner) BFMAdd(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

BFMAdd adds multiple elements to a Bloom filter. Returns an array of booleans indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/bf.madd/

func (AutoPipeliner) BFMExists added in v9.22.0

func (c AutoPipeliner) BFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

BFMExists check if multiple elements exist in a Bloom filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/bf.mexists/

func (AutoPipeliner) BFReserve added in v9.22.0

func (c AutoPipeliner) BFReserve(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd

BFReserve creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. For more information - https://redis.io/commands/bf.reserve/

func (AutoPipeliner) BFReserveExpansion added in v9.22.0

func (c AutoPipeliner) BFReserveExpansion(ctx context.Context, key string, errorRate float64, capacity, expansion int64) *StatusCmd

BFReserveExpansion creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying an expansion rate for the filter. For more information - https://redis.io/commands/bf.reserve/

func (AutoPipeliner) BFReserveNonScaling added in v9.22.0

func (c AutoPipeliner) BFReserveNonScaling(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd

BFReserveNonScaling creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying that the filter should not scale. For more information - https://redis.io/commands/bf.reserve/

func (AutoPipeliner) BFReserveWithArgs added in v9.22.0

func (c AutoPipeliner) BFReserveWithArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd

BFReserveWithArgs creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying additional options such as expansion rate and non-scaling behavior. For more information - https://redis.io/commands/bf.reserve/

func (AutoPipeliner) BFScanDump added in v9.22.0

func (c AutoPipeliner) BFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd

Begins an incremental save of the Bloom filter. This command is useful for large Bloom filters that cannot fit into the DUMP and RESTORE model. For more information - https://redis.io/commands/bf.scandump/

func (AutoPipeliner) BLMPop added in v9.22.0

func (c AutoPipeliner) BLMPop(ctx context.Context, timeout time.Duration, direction string, count int64, keys ...string) *KeyValuesCmd

func (AutoPipeliner) BLMove added in v9.22.0

func (c AutoPipeliner) BLMove(
	ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration,
) *StringCmd

func (AutoPipeliner) BLMoveM added in v9.22.0

func (c AutoPipeliner) BLMoveM(ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration, a LMoveMArgs) *StringSliceCmd

BLMoveM is the blocking variant of LMoveM (Redis 8.10+); timeout 0 blocks forever. Returns moved elements, or redis.Nil on timeout.

func (AutoPipeliner) BLPop added in v9.22.0

func (c AutoPipeliner) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd

func (AutoPipeliner) BRPop added in v9.22.0

func (c AutoPipeliner) BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd

func (AutoPipeliner) BRPopLPush deprecated added in v9.22.0

func (c AutoPipeliner) BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *StringCmd

BRPopLPush pops an element from a list, pushes it to another list and returns it. Blocks until an element is available or timeout is reached.

Deprecated: Use BLMove with RIGHT and LEFT arguments instead as of Redis 6.2.0.

func (AutoPipeliner) BZMPop added in v9.22.0

func (c AutoPipeliner) BZMPop(ctx context.Context, timeout time.Duration, order string, count int64, keys ...string) *ZSliceWithKeyCmd

BZMPop is the blocking variant of ZMPOP. When any of the sorted sets contains elements, this command behaves exactly like ZMPOP. When all sorted sets are empty, Redis will block the connection until another client adds members to one of the keys or until the timeout elapses. A timeout of zero can be used to block indefinitely. example: client.BZMPop(ctx, 0,"max", 1, "set")

func (AutoPipeliner) BZPopMax added in v9.22.0

func (c AutoPipeliner) BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd

BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.

func (AutoPipeliner) BZPopMin added in v9.22.0

func (c AutoPipeliner) BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd

BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.

func (AutoPipeliner) BgRewriteAOF added in v9.22.0

func (c AutoPipeliner) BgRewriteAOF(ctx context.Context) *StatusCmd

func (AutoPipeliner) BgSave added in v9.22.0

func (c AutoPipeliner) BgSave(ctx context.Context) *StatusCmd

func (AutoPipeliner) BitCount added in v9.22.0

func (c AutoPipeliner) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd

func (AutoPipeliner) BitField added in v9.22.0

func (c AutoPipeliner) BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd

BitField accepts multiple values:

  • BitField("set", "i1", "offset1", "value1","cmd2", "type2", "offset2", "value2")
  • BitField([]string{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
  • BitField([]interface{}{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})

func (AutoPipeliner) BitFieldRO added in v9.22.0

func (c AutoPipeliner) BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd

BitFieldRO - Read-only variant of the BITFIELD command. It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas. - BitFieldRO(ctx, key, "<Encoding0>", "<Offset0>", "<Encoding1>","<Offset1>")

func (AutoPipeliner) BitOpAnd added in v9.22.0

func (c AutoPipeliner) BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpAnd creates a new bitmap in which users are members of all given bitmaps

func (AutoPipeliner) BitOpAndOr added in v9.22.0

func (c AutoPipeliner) BitOpAndOr(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpAndOr creates a new bitmap in which users are members of bitmap X and also members of one or more of bitmaps Y1, Y2, … Introduced with Redis 8.2

func (AutoPipeliner) BitOpDiff added in v9.22.0

func (c AutoPipeliner) BitOpDiff(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpDiff creates a new bitmap in which users are members of bitmap X but not of any of bitmaps Y1, Y2, … Introduced with Redis 8.2

func (AutoPipeliner) BitOpDiff1 added in v9.22.0

func (c AutoPipeliner) BitOpDiff1(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpDiff1 creates a new bitmap in which users are members of one or more of bitmaps Y1, Y2, … but not members of bitmap X Introduced with Redis 8.2

func (AutoPipeliner) BitOpNot added in v9.22.0

func (c AutoPipeliner) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd

BitOpNot creates a new bitmap in which users are not members of a given bitmap

func (AutoPipeliner) BitOpOne added in v9.22.0

func (c AutoPipeliner) BitOpOne(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpOne creates a new bitmap in which users are members of exactly one of the given bitmaps Introduced with Redis 8.2

func (AutoPipeliner) BitOpOr added in v9.22.0

func (c AutoPipeliner) BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpOr creates a new bitmap in which users are member of at least one given bitmap

func (AutoPipeliner) BitOpXor added in v9.22.0

func (c AutoPipeliner) BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpXor creates a new bitmap in which users are the result of XORing all given bitmaps

func (AutoPipeliner) BitPos added in v9.22.0

func (c AutoPipeliner) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd

BitPos is an API before Redis version 7.0, cmd: bitpos key bit start end if you need the `byte | bit` parameter, please use `BitPosSpan`.

func (AutoPipeliner) BitPosSpan added in v9.22.0

func (c AutoPipeliner) BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *IntCmd

BitPosSpan supports the `byte | bit` parameters in redis version 7.0, the bitpos command defaults to using byte type for the `start-end` range, which means it counts in bytes from start to end. you can set the value of "span" to determine the type of `start-end`. span = "bit", cmd: bitpos key bit start end bit span = "byte", cmd: bitpos key bit start end byte

func (AutoPipeliner) CFAdd added in v9.22.0

func (c AutoPipeliner) CFAdd(ctx context.Context, key string, element interface{}) *BoolCmd

CFAdd adds an element to a Cuckoo filter. Returns true if the element was added to the filter or false if it already exists in the filter. For more information - https://redis.io/commands/cf.add/

func (AutoPipeliner) CFAddNX added in v9.22.0

func (c AutoPipeliner) CFAddNX(ctx context.Context, key string, element interface{}) *BoolCmd

CFAddNX adds an element to a Cuckoo filter only if it does not already exist in the filter. Returns true if the element was added to the filter or false if it already exists in the filter. For more information - https://redis.io/commands/cf.addnx/

func (AutoPipeliner) CFCount added in v9.22.0

func (c AutoPipeliner) CFCount(ctx context.Context, key string, element interface{}) *IntCmd

CFCount returns an estimate of the number of times an element may be in a Cuckoo Filter. For more information - https://redis.io/commands/cf.count/

func (AutoPipeliner) CFDel added in v9.22.0

func (c AutoPipeliner) CFDel(ctx context.Context, key string, element interface{}) *BoolCmd

CFDel deletes an item once from the cuckoo filter. For more information - https://redis.io/commands/cf.del/

func (AutoPipeliner) CFExists added in v9.22.0

func (c AutoPipeliner) CFExists(ctx context.Context, key string, element interface{}) *BoolCmd

CFExists determines whether an item may exist in the Cuckoo Filter or not. For more information - https://redis.io/commands/cf.exists/

func (AutoPipeliner) CFInfo added in v9.22.0

func (c AutoPipeliner) CFInfo(ctx context.Context, key string) *CFInfoCmd

CFInfo returns information about a Cuckoo filter. For more information - https://redis.io/commands/cf.info/

func (AutoPipeliner) CFInsert added in v9.22.0

func (c AutoPipeliner) CFInsert(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *BoolSliceCmd

CFInsert inserts elements into a Cuckoo filter. This function also allows for specifying additional options such as capacity, error rate, expansion rate, and non-scaling behavior. Returns an array of booleans indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/cf.insert/

func (AutoPipeliner) CFInsertNX added in v9.22.0

func (c AutoPipeliner) CFInsertNX(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *IntSliceCmd

CFInsertNX inserts elements into a Cuckoo filter only if they do not already exist in the filter. This function also allows for specifying additional options such as: capacity, error rate, expansion rate, and non-scaling behavior. Returns an array of integers indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/cf.insertnx/

func (AutoPipeliner) CFLoadChunk added in v9.22.0

func (c AutoPipeliner) CFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd

CFLoadChunk restores a filter previously saved using SCANDUMP. For more information - https://redis.io/commands/cf.loadchunk/

func (AutoPipeliner) CFMExists added in v9.22.0

func (c AutoPipeliner) CFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

CFMExists check if multiple elements exist in a Cuckoo filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/cf.mexists/

func (AutoPipeliner) CFReserve added in v9.22.0

func (c AutoPipeliner) CFReserve(ctx context.Context, key string, capacity int64) *StatusCmd

CFReserve creates an empty Cuckoo filter with the specified capacity. For more information - https://redis.io/commands/cf.reserve/

func (AutoPipeliner) CFReserveBucketSize added in v9.22.0

func (c AutoPipeliner) CFReserveBucketSize(ctx context.Context, key string, capacity int64, bucketsize int64) *StatusCmd

CFReserveBucketSize creates an empty Cuckoo filter with the specified capacity and bucket size. For more information - https://redis.io/commands/cf.reserve/

func (AutoPipeliner) CFReserveExpansion added in v9.22.0

func (c AutoPipeliner) CFReserveExpansion(ctx context.Context, key string, capacity int64, expansion int64) *StatusCmd

CFReserveExpansion creates an empty Cuckoo filter with the specified capacity and expansion rate. For more information - https://redis.io/commands/cf.reserve/

func (AutoPipeliner) CFReserveMaxIterations added in v9.22.0

func (c AutoPipeliner) CFReserveMaxIterations(ctx context.Context, key string, capacity int64, maxiterations int64) *StatusCmd

CFReserveMaxIterations creates an empty Cuckoo filter with the specified capacity and maximum number of iterations. For more information - https://redis.io/commands/cf.reserve/

func (AutoPipeliner) CFReserveWithArgs added in v9.22.0

func (c AutoPipeliner) CFReserveWithArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd

CFReserveWithArgs creates an empty Cuckoo filter with the specified options. This function allows for specifying additional options such as bucket size and maximum number of iterations. For more information - https://redis.io/commands/cf.reserve/

func (AutoPipeliner) CFScanDump added in v9.22.0

func (c AutoPipeliner) CFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd

CFScanDump begins an incremental save of the cuckoo filter. For more information - https://redis.io/commands/cf.scandump/

func (AutoPipeliner) CMSIncrBy added in v9.22.0

func (c AutoPipeliner) CMSIncrBy(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

CMSIncrBy increments the count of one or more items in a Count-Min Sketch filter. Returns an array of integers representing the updated count of each item. For more information - https://redis.io/commands/cms.incrby/

func (AutoPipeliner) CMSInfo added in v9.22.0

func (c AutoPipeliner) CMSInfo(ctx context.Context, key string) *CMSInfoCmd

CMSInfo returns information about a Count-Min Sketch filter. For more information - https://redis.io/commands/cms.info/

func (AutoPipeliner) CMSInitByDim added in v9.22.0

func (c AutoPipeliner) CMSInitByDim(ctx context.Context, key string, width, depth int64) *StatusCmd

CMSInitByDim creates an empty Count-Min Sketch filter with the specified dimensions. For more information - https://redis.io/commands/cms.initbydim/

func (AutoPipeliner) CMSInitByProb added in v9.22.0

func (c AutoPipeliner) CMSInitByProb(ctx context.Context, key string, errorRate, probability float64) *StatusCmd

CMSInitByProb creates an empty Count-Min Sketch filter with the specified error rate and probability. For more information - https://redis.io/commands/cms.initbyprob/

func (AutoPipeliner) CMSMerge added in v9.22.0

func (c AutoPipeliner) CMSMerge(ctx context.Context, destKey string, sourceKeys ...string) *StatusCmd

CMSMerge merges multiple Count-Min Sketch filters into a single filter. The destination filter must not exist and will be created with the dimensions of the first source filter. The number of items in each source filter must be equal. Returns OK on success or an error if the filters could not be merged. For more information - https://redis.io/commands/cms.merge/

func (AutoPipeliner) CMSMergeWithWeight added in v9.22.0

func (c AutoPipeliner) CMSMergeWithWeight(ctx context.Context, destKey string, sourceKeys map[string]int64) *StatusCmd

CMSMergeWithWeight merges multiple Count-Min Sketch filters into a single filter with weights for each source filter. The destination filter must not exist and will be created with the dimensions of the first source filter. The number of items in each source filter must be equal. Returns OK on success or an error if the filters could not be merged. For more information - https://redis.io/commands/cms.merge/

func (AutoPipeliner) CMSQuery added in v9.22.0

func (c AutoPipeliner) CMSQuery(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

CMSQuery returns count for item(s). For more information - https://redis.io/commands/cms.query/

func (AutoPipeliner) ClientGetName added in v9.22.0

func (c AutoPipeliner) ClientGetName(ctx context.Context) *StringCmd

ClientGetName returns the name of the connection.

func (AutoPipeliner) ClientID added in v9.22.0

func (c AutoPipeliner) ClientID(ctx context.Context) *IntCmd

func (AutoPipeliner) ClientInfo added in v9.22.0

func (c AutoPipeliner) ClientInfo(ctx context.Context) *ClientInfoCmd

func (AutoPipeliner) ClientKill added in v9.22.0

func (c AutoPipeliner) ClientKill(ctx context.Context, ipPort string) *StatusCmd

func (AutoPipeliner) ClientKillByFilter added in v9.22.0

func (c AutoPipeliner) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (AutoPipeliner) ClientList added in v9.22.0

func (c AutoPipeliner) ClientList(ctx context.Context) *StringCmd

func (AutoPipeliner) ClientMaintNotifications added in v9.22.0

func (c AutoPipeliner) ClientMaintNotifications(ctx context.Context, enabled bool, endpointType string) *StatusCmd

ClientMaintNotifications enables or disables maintenance notifications for maintenance upgrades. When enabled, the client will receive push notifications about Redis maintenance events.

func (AutoPipeliner) ClientPause added in v9.22.0

func (c AutoPipeliner) ClientPause(ctx context.Context, dur time.Duration) *BoolCmd

func (AutoPipeliner) ClientTracking added in v9.22.0

func (c AutoPipeliner) ClientTracking(ctx context.Context, on bool, opt *ClientTrackingOptions) *StatusCmd

ClientTracking enables or disables server-assisted client-side caching for the ONE connection that happens to serve this command. On a pooled client that connection is arbitrary, so this is only meaningful on a dedicated connection (see Client.Conn). When on is false, opt is ignored. Invalid option combinations are reported via the returned command's Err and nothing is sent to the server.

Must not be combined with the built-in client-side cache: on a client configured with Options.ClientSideCache or ClientSideCacheConfig this command is rejected, because changing a pool connection's tracking state would silently break the cache's invalidation.

func (AutoPipeliner) ClientTrackingOff added in v9.22.0

func (c AutoPipeliner) ClientTrackingOff(ctx context.Context) *StatusCmd

ClientTrackingOff disables tracking on the serving connection. See ClientTracking for the pooled-client and built-in-CSC caveats.

func (AutoPipeliner) ClientTrackingOn added in v9.22.0

func (c AutoPipeliner) ClientTrackingOn(ctx context.Context, opt *ClientTrackingOptions) *StatusCmd

ClientTrackingOn enables tracking on the serving connection. See ClientTracking for the pooled-client and built-in-CSC caveats.

func (AutoPipeliner) ClientUnblock added in v9.22.0

func (c AutoPipeliner) ClientUnblock(ctx context.Context, id int64) *IntCmd

func (AutoPipeliner) ClientUnblockWithError added in v9.22.0

func (c AutoPipeliner) ClientUnblockWithError(ctx context.Context, id int64) *IntCmd

func (AutoPipeliner) ClientUnpause added in v9.22.0

func (c AutoPipeliner) ClientUnpause(ctx context.Context) *BoolCmd

func (*AutoPipeliner) Close added in v9.22.0

func (ap *AutoPipeliner) Close() error

Close stops the autopipeliner and flushes any pending commands. Worst case it blocks up to the internal permit backstop (~30s) PER SHARD if in-flight batches are wedged (e.g. read timeouts disabled against a dead peer) — healthy shutdowns take one round trip per shard with commands queued, near-zero otherwise.

func (AutoPipeliner) ClusterAddSlots added in v9.22.0

func (c AutoPipeliner) ClusterAddSlots(ctx context.Context, slots ...int) *StatusCmd

func (AutoPipeliner) ClusterAddSlotsRange added in v9.22.0

func (c AutoPipeliner) ClusterAddSlotsRange(ctx context.Context, min, max int) *StatusCmd

func (AutoPipeliner) ClusterCountFailureReports added in v9.22.0

func (c AutoPipeliner) ClusterCountFailureReports(ctx context.Context, nodeID string) *IntCmd

func (AutoPipeliner) ClusterCountKeysInSlot added in v9.22.0

func (c AutoPipeliner) ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd

func (AutoPipeliner) ClusterDelSlots added in v9.22.0

func (c AutoPipeliner) ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd

func (AutoPipeliner) ClusterDelSlotsRange added in v9.22.0

func (c AutoPipeliner) ClusterDelSlotsRange(ctx context.Context, min, max int) *StatusCmd

func (AutoPipeliner) ClusterFailover added in v9.22.0

func (c AutoPipeliner) ClusterFailover(ctx context.Context) *StatusCmd

func (AutoPipeliner) ClusterForget added in v9.22.0

func (c AutoPipeliner) ClusterForget(ctx context.Context, nodeID string) *StatusCmd

func (AutoPipeliner) ClusterGetKeysInSlot added in v9.22.0

func (c AutoPipeliner) ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *StringSliceCmd

func (AutoPipeliner) ClusterInfo added in v9.22.0

func (c AutoPipeliner) ClusterInfo(ctx context.Context) *StringCmd

func (AutoPipeliner) ClusterKeySlot added in v9.22.0

func (c AutoPipeliner) ClusterKeySlot(ctx context.Context, key string) *IntCmd
func (c AutoPipeliner) ClusterLinks(ctx context.Context) *ClusterLinksCmd

func (AutoPipeliner) ClusterMeet added in v9.22.0

func (c AutoPipeliner) ClusterMeet(ctx context.Context, host, port string) *StatusCmd

func (AutoPipeliner) ClusterMyID added in v9.22.0

func (c AutoPipeliner) ClusterMyID(ctx context.Context) *StringCmd

func (AutoPipeliner) ClusterMyShardID added in v9.22.0

func (c AutoPipeliner) ClusterMyShardID(ctx context.Context) *StringCmd

func (AutoPipeliner) ClusterNodes added in v9.22.0

func (c AutoPipeliner) ClusterNodes(ctx context.Context) *StringCmd

func (AutoPipeliner) ClusterReplicate added in v9.22.0

func (c AutoPipeliner) ClusterReplicate(ctx context.Context, nodeID string) *StatusCmd

func (AutoPipeliner) ClusterResetHard added in v9.22.0

func (c AutoPipeliner) ClusterResetHard(ctx context.Context) *StatusCmd

func (AutoPipeliner) ClusterResetSoft added in v9.22.0

func (c AutoPipeliner) ClusterResetSoft(ctx context.Context) *StatusCmd

func (AutoPipeliner) ClusterSaveConfig added in v9.22.0

func (c AutoPipeliner) ClusterSaveConfig(ctx context.Context) *StatusCmd

func (AutoPipeliner) ClusterShards added in v9.22.0

func (c AutoPipeliner) ClusterShards(ctx context.Context) *ClusterShardsCmd

func (AutoPipeliner) ClusterSlaves deprecated added in v9.22.0

func (c AutoPipeliner) ClusterSlaves(ctx context.Context, nodeID string) *StringSliceCmd

ClusterSlaves lists the replica nodes of a master node.

Deprecated: Use ClusterReplicas instead as of Redis 5.0.0.

func (AutoPipeliner) ClusterSlots deprecated added in v9.22.0

func (c AutoPipeliner) ClusterSlots(ctx context.Context) *ClusterSlotsCmd

ClusterSlots returns the mapping of cluster slots to nodes.

Deprecated: Use ClusterShards instead as of Redis 7.0.0.

func (AutoPipeliner) Command added in v9.22.0

func (c AutoPipeliner) Command(ctx context.Context) *CommandsInfoCmd

func (AutoPipeliner) CommandGetKeys added in v9.22.0

func (c AutoPipeliner) CommandGetKeys(ctx context.Context, commands ...interface{}) *StringSliceCmd

func (AutoPipeliner) CommandGetKeysAndFlags added in v9.22.0

func (c AutoPipeliner) CommandGetKeysAndFlags(ctx context.Context, commands ...interface{}) *KeyFlagsCmd

func (AutoPipeliner) CommandList added in v9.22.0

func (c AutoPipeliner) CommandList(ctx context.Context, filter *FilterBy) *StringSliceCmd

func (*AutoPipeliner) Config added in v9.22.0

func (ap *AutoPipeliner) Config() AutoPipelineOptions

Config returns a copy of the effective configuration (defaults filled in).

func (AutoPipeliner) ConfigGet added in v9.22.0

func (c AutoPipeliner) ConfigGet(ctx context.Context, parameter string) *MapStringStringCmd

func (AutoPipeliner) ConfigResetStat added in v9.22.0

func (c AutoPipeliner) ConfigResetStat(ctx context.Context) *StatusCmd

func (AutoPipeliner) ConfigRewrite added in v9.22.0

func (c AutoPipeliner) ConfigRewrite(ctx context.Context) *StatusCmd

func (AutoPipeliner) ConfigSet added in v9.22.0

func (c AutoPipeliner) ConfigSet(ctx context.Context, parameter, value string) *StatusCmd

func (AutoPipeliner) Copy added in v9.22.0

func (c AutoPipeliner) Copy(ctx context.Context, sourceKey, destKey string, db int, replace bool) *IntCmd

func (*AutoPipeliner) DBSize added in v9.22.0

func (ap *AutoPipeliner) DBSize(ctx context.Context) *IntCmd

DBSize delegates to the underlying client (cluster-wide sum on ClusterClient).

func (AutoPipeliner) DebugObject added in v9.22.0

func (c AutoPipeliner) DebugObject(ctx context.Context, key string) *StringCmd

func (AutoPipeliner) Decr added in v9.22.0

func (c AutoPipeliner) Decr(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) DecrBy added in v9.22.0

func (c AutoPipeliner) DecrBy(ctx context.Context, key string, decrement int64) *IntCmd

func (AutoPipeliner) Del added in v9.22.0

func (c AutoPipeliner) Del(ctx context.Context, keys ...string) *IntCmd

func (AutoPipeliner) DelExArgs added in v9.22.0

func (c AutoPipeliner) DelExArgs(ctx context.Context, key string, a DelExArgs) *IntCmd

DelExArgs Redis `DELEX key [IFEQ|IFNE|IFDEQ|IFDNE] match-value` command. Compare-and-delete with flexible conditions.

Returns the number of keys that were removed (0 or 1).

NOTE DelExArgs is still experimental it's signature and behaviour may change

func (AutoPipeliner) Digest added in v9.22.0

func (c AutoPipeliner) Digest(ctx context.Context, key string) *DigestCmd

Digest returns the xxh3 hash (uint64) of the specified key's value.

The digest is a 64-bit xxh3 hash that can be used for optimistic locking with SetIFDEQ, SetIFDNE, and DelExArgs commands.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/digest/

NOTE Digest is still experimental it's signature and behaviour may change

func (*AutoPipeliner) Do added in v9.22.0

func (ap *AutoPipeliner) Do(ctx context.Context, args ...interface{}) *Cmd

Do executes a raw command on a NORMAL connection, outside the pipeline. Arbitrary command names can carry connection state (SELECT, MULTI, SUBSCRIBE, CLIENT ...) or block the connection (BLPOP ...); batching those onto a shared pipeline connection would silently poison it for every later batch, or stall unrelated commands. (Submit enforces the same rule for raw Cmders: names in the connection-hostile set are diverted off the pipeline automatically.) The typed surface (ap.Set, ap.Get, ...) is safe by construction and IS batched — prefer it. Do carries the same caveats as Client.Do: a stateful command still affects the (normal, non-pipeline) pooled connection it runs on. Do keeps each face's call shape: on a blocking autopipeliner the call blocks until the command has executed; on a deferred (async) one it returns immediately and the command's result accessors (Err/Val/Result) block until it completes.

func (*AutoPipeliner) DoRaw added in v9.22.0

func (ap *AutoPipeliner) DoRaw(ctx context.Context, args ...interface{}) *RawCmd

DoRaw mirrors Do for raw RESP access: AutoPipeliner embeds cmdable, so without this override DoRaw would ride the batching engine — but raw commands carry Do's caveats and DoRawWriteTo-style streaming must not run inside a shared batch's reply loop. Runs outside the pipeline, following the face's call shape (see Do).

func (*AutoPipeliner) DoRawWriteTo added in v9.22.0

func (ap *AutoPipeliner) DoRawWriteTo(ctx context.Context, w io.Writer, args ...interface{}) *RawWriteToCmd

DoRawWriteTo mirrors Do for streamed raw RESP access (see DoRaw). On the deferred face the write to w happens when the command executes; use the result accessors (Err/Written) to wait before reading w.

func (AutoPipeliner) Dump added in v9.22.0

func (c AutoPipeliner) Dump(ctx context.Context, key string) *StringCmd

func (AutoPipeliner) Echo added in v9.22.0

func (c AutoPipeliner) Echo(ctx context.Context, message interface{}) *StringCmd

func (AutoPipeliner) Eval added in v9.22.0

func (c AutoPipeliner) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd

func (AutoPipeliner) EvalRO added in v9.22.0

func (c AutoPipeliner) EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd

func (AutoPipeliner) EvalSha added in v9.22.0

func (c AutoPipeliner) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd

func (AutoPipeliner) EvalShaRO added in v9.22.0

func (c AutoPipeliner) EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd

func (AutoPipeliner) Exists added in v9.22.0

func (c AutoPipeliner) Exists(ctx context.Context, keys ...string) *IntCmd

func (AutoPipeliner) Expire added in v9.22.0

func (c AutoPipeliner) Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (AutoPipeliner) ExpireAt added in v9.22.0

func (c AutoPipeliner) ExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd

func (AutoPipeliner) ExpireGT added in v9.22.0

func (c AutoPipeliner) ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (AutoPipeliner) ExpireLT added in v9.22.0

func (c AutoPipeliner) ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (AutoPipeliner) ExpireNX added in v9.22.0

func (c AutoPipeliner) ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (AutoPipeliner) ExpireTime added in v9.22.0

func (c AutoPipeliner) ExpireTime(ctx context.Context, key string) *DurationCmd

ExpireTime returns the absolute expiration time of key as a Unix timestamp encoded in *DurationCmd (seconds since the epoch), not a remaining TTL. Convert with: time.Unix(int64(d/time.Second), 0). Use TTL/PTTL for remaining TTL.

func (AutoPipeliner) ExpireXX added in v9.22.0

func (c AutoPipeliner) ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (AutoPipeliner) FCall added in v9.22.0

func (c AutoPipeliner) FCall(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

func (AutoPipeliner) FCallRO added in v9.22.0

func (c AutoPipeliner) FCallRO(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

func (AutoPipeliner) FCallRo added in v9.22.0

func (c AutoPipeliner) FCallRo(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

FCallRo this function simply calls FCallRO, Deprecated: to maintain convention FCallRO.

func (*AutoPipeliner) FDPipelined added in v9.23.0

func (ap *AutoPipeliner) FDPipelined(ctx context.Context, cmds []Cmder) error

FDPipelined submits cmds as one contiguous batch on the full-duplex connection and blocks until every reply has landed. It returns the first command error, Nil included, the same as Pipeline.Exec.

Two differences from an ordinary pipeline. Retryable replies (LOADING and the like) are not retried here; Pipeline() retries the whole batch on top of this, see fdPipelineExec. And once the batch is admitted, ctx no longer bounds the wait: the commands share the held connection with other callers, so they cannot be abandoned mid-stream. ReadTimeout still bounds each reply.

Compared with the two shapes that already exist:

  • Pipeline().Exec() batches up front and blocks, but on a pooled connection: a separate socket, its own round trip, no FD engine.
  • Submit()/the async face keeps N commands in flight on the FD wire with individual completion, but the caller issues them one at a time and they may interleave with other callers' commands.

This is the third: batched up front, contiguous, blocking, on the FD wire.

The commands are still completed individually by the reader, so after this returns each cmd carries its own result and error.

Hooks and metrics match an ordinary pipeline: the client's ProcessPipelineHook chain runs around the batch (per-command ProcessHooks do not, as in an ordinary pipeline), and an OTel recorder gets one pipeline duration and, on failure, one pipeline-level error rather than per-command metrics. A Limiter is the exception: the FD writer asks it once per write chunk, and a chunk can mix this batch with other callers' commands, so a batch longer than MaxBatchSize (or MaxBatchBytes) can be partly admitted.

EXPERIMENTAL: this API is subject to change, use with caution.

func (AutoPipeliner) FTAggregate added in v9.22.0

func (c AutoPipeliner) FTAggregate(ctx context.Context, index string, query string) *MapStringInterfaceCmd

FTAggregate - Performs a search query on an index and applies a series of aggregate transformations to the result. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. For more information, please refer to the Redis documentation: [FT.AGGREGATE]: (https://redis.io/commands/ft.aggregate/)

func (AutoPipeliner) FTAggregateWithArgs added in v9.22.0

func (c AutoPipeliner) FTAggregateWithArgs(ctx context.Context, index string, query string, options *FTAggregateOptions) *AggregateCmd

FTAggregateWithArgs - Performs a search query on an index and applies a series of aggregate transformations to the result. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. This function also allows for specifying additional options such as: Verbatim, LoadAll, Load, Timeout, GroupBy, SortBy, SortByMax, Apply, LimitOffset, Limit, Filter, WithCursor, Params, and DialectVersion. For more information, please refer to the Redis documentation: [FT.AGGREGATE]: (https://redis.io/commands/ft.aggregate/)

func (AutoPipeliner) FTAliasAdd added in v9.22.0

func (c AutoPipeliner) FTAliasAdd(ctx context.Context, index string, alias string) *StatusCmd

FTAliasAdd - Adds an alias to an index. The 'index' parameter specifies the index to which the alias is added, and the 'alias' parameter specifies the alias. For more information, please refer to the Redis documentation: [FT.ALIASADD]: (https://redis.io/commands/ft.aliasadd/)

func (AutoPipeliner) FTAliasDel added in v9.22.0

func (c AutoPipeliner) FTAliasDel(ctx context.Context, alias string) *StatusCmd

FTAliasDel - Removes an alias from an index. The 'alias' parameter specifies the alias to be removed. For more information, please refer to the Redis documentation: [FT.ALIASDEL]: (https://redis.io/commands/ft.aliasdel/)

func (AutoPipeliner) FTAliasList added in v9.22.0

func (c AutoPipeliner) FTAliasList(ctx context.Context, index string) *StringSliceCmd

FTAliasList - Lists all aliases associated with an index. The 'index' parameter specifies the index whose aliases are listed; it must be the name of an index created with FT.CREATE, not an alias. The reply is an unordered collection of alias names, already deduplicated by the server; an index with no aliases yields an empty result, not an error. Available since Redis 8.10. For more information, please refer to the Redis documentation: [FT.ALIASLIST]: (https://redis.io/commands/ft.aliaslist/)

func (AutoPipeliner) FTAliasUpdate added in v9.22.0

func (c AutoPipeliner) FTAliasUpdate(ctx context.Context, index string, alias string) *StatusCmd

FTAliasUpdate - Updates an alias to an index. The 'index' parameter specifies the index to which the alias is updated, and the 'alias' parameter specifies the alias. If the alias already exists for a different index, it updates the alias to point to the specified index instead. For more information, please refer to the Redis documentation: [FT.ALIASUPDATE]: (https://redis.io/commands/ft.aliasupdate/)

func (AutoPipeliner) FTAlter added in v9.22.0

func (c AutoPipeliner) FTAlter(ctx context.Context, index string, skipInitialScan bool, definition []interface{}) *StatusCmd

FTAlter - Alters the definition of an existing index. The 'index' parameter specifies the index to alter, and the 'skipInitialScan' parameter specifies whether to skip the initial scan. The 'definition' parameter specifies the new definition for the index. For more information, please refer to the Redis documentation: [FT.ALTER]: (https://redis.io/commands/ft.alter/)

func (AutoPipeliner) FTConfigGet deprecated added in v9.22.0

func (c AutoPipeliner) FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd

Retrieves the value of a RediSearch configuration parameter. The 'option' parameter specifies the configuration parameter to retrieve. For more information, please refer to the Redis FT.CONFIG GET documentation.

Deprecated: FTConfigGet is deprecated in Redis 8. All configuration will be done with the CONFIG GET command. For more information check Client.ConfigGet and CONFIG GET Documentation

func (AutoPipeliner) FTConfigSet deprecated added in v9.22.0

func (c AutoPipeliner) FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd

Sets the value of a RediSearch configuration parameter. The 'option' parameter specifies the configuration parameter to set, and the 'value' parameter specifies the new value. For more information, please refer to the Redis FT.CONFIG SET documentation.

Deprecated: FTConfigSet is deprecated in Redis 8. All configuration will be done with the CONFIG SET command. For more information check Client.ConfigSet and CONFIG SET Documentation

func (AutoPipeliner) FTCreate added in v9.22.0

func (c AutoPipeliner) FTCreate(ctx context.Context, index string, options *FTCreateOptions, schema ...*FieldSchema) *StatusCmd

FTCreate - Creates a new index with the given options and schema. The 'index' parameter specifies the name of the index to create. The 'options' parameter specifies various options for the index, such as: whether to index hashes or JSONs, prefixes, filters, default language, score, score field, payload field, etc. The 'schema' parameter specifies the schema for the index, which includes the field name, field type, etc. For more information, please refer to the Redis documentation: [FT.CREATE]: (https://redis.io/commands/ft.create/)

func (AutoPipeliner) FTCursorDel added in v9.22.0

func (c AutoPipeliner) FTCursorDel(ctx context.Context, index string, cursorId int) *StatusCmd

FTCursorDel - Deletes a cursor from an existing index. The 'index' parameter specifies the index from which to delete the cursor, and the 'cursorId' parameter specifies the ID of the cursor to delete. For more information, please refer to the Redis documentation: [FT.CURSOR DEL]: (https://redis.io/commands/ft.cursor-del/)

func (AutoPipeliner) FTCursorRead added in v9.22.0

func (c AutoPipeliner) FTCursorRead(ctx context.Context, index string, cursorId int, count int) *MapStringInterfaceCmd

FTCursorRead - Reads the next results from an existing cursor. The 'index' parameter specifies the index from which to read the cursor, the 'cursorId' parameter specifies the ID of the cursor to read, and the 'count' parameter specifies the number of results to read. For more information, please refer to the Redis documentation: [FT.CURSOR READ]: (https://redis.io/commands/ft.cursor-read/)

func (AutoPipeliner) FTDictAdd added in v9.22.0

func (c AutoPipeliner) FTDictAdd(ctx context.Context, dict string, term ...interface{}) *IntCmd

FTDictAdd - Adds terms to a dictionary. The 'dict' parameter specifies the dictionary to which to add the terms, and the 'term' parameter specifies the terms to add. For more information, please refer to the Redis documentation: [FT.DICTADD]: (https://redis.io/commands/ft.dictadd/)

func (AutoPipeliner) FTDictDel added in v9.22.0

func (c AutoPipeliner) FTDictDel(ctx context.Context, dict string, term ...interface{}) *IntCmd

FTDictDel - Deletes terms from a dictionary. The 'dict' parameter specifies the dictionary from which to delete the terms, and the 'term' parameter specifies the terms to delete. For more information, please refer to the Redis documentation: [FT.DICTDEL]: (https://redis.io/commands/ft.dictdel/)

func (AutoPipeliner) FTDictDump added in v9.22.0

func (c AutoPipeliner) FTDictDump(ctx context.Context, dict string) *StringSliceCmd

FTDictDump - Returns all terms in the specified dictionary. The 'dict' parameter specifies the dictionary from which to return the terms. For more information, please refer to the Redis documentation: [FT.DICTDUMP]: (https://redis.io/commands/ft.dictdump/)

func (AutoPipeliner) FTDropIndex added in v9.22.0

func (c AutoPipeliner) FTDropIndex(ctx context.Context, index string) *StatusCmd

FTDropIndex - Deletes an index. The 'index' parameter specifies the index to delete. For more information, please refer to the Redis documentation: [FT.DROPINDEX]: (https://redis.io/commands/ft.dropindex/)

func (AutoPipeliner) FTDropIndexWithArgs added in v9.22.0

func (c AutoPipeliner) FTDropIndexWithArgs(ctx context.Context, index string, options *FTDropIndexOptions) *StatusCmd

FTDropIndexWithArgs - Deletes an index with options. The 'index' parameter specifies the index to delete, and the 'options' parameter specifies the DeleteDocs option for docs deletion. For more information, please refer to the Redis documentation: [FT.DROPINDEX]: (https://redis.io/commands/ft.dropindex/)

func (AutoPipeliner) FTExplain added in v9.22.0

func (c AutoPipeliner) FTExplain(ctx context.Context, index string, query string) *StringCmd

FTExplain - Returns the execution plan for a complex query. The 'index' parameter specifies the index to query, and the 'query' parameter specifies the query string. For more information, please refer to the Redis documentation: [FT.EXPLAIN]: (https://redis.io/commands/ft.explain/)

func (AutoPipeliner) FTExplainCli added in v9.22.0

func (c AutoPipeliner) FTExplainCli(ctx context.Context, key, path string) error

FTExplainCli - Returns the execution plan for a complex query. [Not Implemented] For more information, see https://redis.io/commands/ft.explaincli/

func (AutoPipeliner) FTExplainWithArgs added in v9.22.0

func (c AutoPipeliner) FTExplainWithArgs(ctx context.Context, index string, query string, options *FTExplainOptions) *StringCmd

FTExplainWithArgs - Returns the execution plan for a complex query with options. The 'index' parameter specifies the index to query, the 'query' parameter specifies the query string, and the 'options' parameter specifies the Dialect for the query. For more information, please refer to the Redis documentation: [FT.EXPLAIN]: (https://redis.io/commands/ft.explain/)

func (AutoPipeliner) FTHybrid added in v9.22.0

func (c AutoPipeliner) FTHybrid(ctx context.Context, index string, searchExpr string, vectorField string, vectorData Vector) *FTHybridCmd

FTHybrid - Executes a hybrid search combining full-text search and vector similarity The 'index' parameter specifies the index to search, 'searchExpr' is the search query, 'vectorField' is the name of the vector field, and 'vectorData' is the vector to search with. FTHybrid is still experimental, the command behaviour and signature may change

func (AutoPipeliner) FTHybridWithArgs added in v9.22.0

func (c AutoPipeliner) FTHybridWithArgs(ctx context.Context, index string, options *FTHybridOptions) *FTHybridCmd

FTHybridWithArgs - Executes a hybrid search with advanced options FTHybridWithArgs is still experimental, the command behaviour and signature may change

Vector data is always sent through the PARAMS mechanism, because inline vector blobs are no longer supported by Redis. For every vector expression whose VectorParamName is empty, a unique name is generated (e.g. "__vector_param_0") and the corresponding blob is passed via PARAMS.

options.Params is never mutated: the command is built from a local copy that combines the caller-provided params with any generated vector parameters. This makes it safe to reuse the same *FTHybridOptions across multiple calls. Generated names are also reserved against all explicit VectorParamName values, so they never collide with explicit names (even those following the "__vector_param_N" pattern).

func (AutoPipeliner) FTInfo added in v9.22.0

func (c AutoPipeliner) FTInfo(ctx context.Context, index string) *FTInfoCmd

FTInfo - Retrieves information about an index. The 'index' parameter specifies the index to retrieve information about. For more information, please refer to the Redis documentation: [FT.INFO]: (https://redis.io/commands/ft.info/)

func (AutoPipeliner) FTSearch added in v9.22.0

func (c AutoPipeliner) FTSearch(ctx context.Context, index string, query string) *FTSearchCmd

FTSearch - Executes a search query on an index. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. For more information, please refer to the Redis documentation about [FT.SEARCH].

[FT.SEARCH]: (https://redis.io/commands/ft.search/)

func (AutoPipeliner) FTSearchWithArgs added in v9.22.0

func (c AutoPipeliner) FTSearchWithArgs(ctx context.Context, index string, query string, options *FTSearchOptions) *FTSearchCmd

FTSearchWithArgs - Executes a search query on an index with additional options. The 'index' parameter specifies the index to search, the 'query' parameter specifies the search query, and the 'options' parameter specifies additional options for the search. For more information, please refer to the Redis documentation about [FT.SEARCH].

[FT.SEARCH]: (https://redis.io/commands/ft.search/)

func (AutoPipeliner) FTSpellCheck added in v9.22.0

func (c AutoPipeliner) FTSpellCheck(ctx context.Context, index string, query string) *FTSpellCheckCmd

FTSpellCheck - Checks a query string for spelling errors. For more details about spellcheck query please follow: https://redis.io/docs/interact/search-and-query/advanced-concepts/spellcheck/ For more information, please refer to the Redis documentation: [FT.SPELLCHECK]: (https://redis.io/commands/ft.spellcheck/)

func (AutoPipeliner) FTSpellCheckWithArgs added in v9.22.0

func (c AutoPipeliner) FTSpellCheckWithArgs(ctx context.Context, index string, query string, options *FTSpellCheckOptions) *FTSpellCheckCmd

FTSpellCheckWithArgs - Checks a query string for spelling errors with additional options. For more details about spellcheck query please follow: https://redis.io/docs/interact/search-and-query/advanced-concepts/spellcheck/ For more information, please refer to the Redis documentation: [FT.SPELLCHECK]: (https://redis.io/commands/ft.spellcheck/)

func (AutoPipeliner) FTSynDump added in v9.22.0

func (c AutoPipeliner) FTSynDump(ctx context.Context, index string) *FTSynDumpCmd

FTSynDump - Dumps the contents of a synonym group. The 'index' parameter specifies the index to dump. For more information, please refer to the Redis documentation: [FT.SYNDUMP]: (https://redis.io/commands/ft.syndump/)

func (AutoPipeliner) FTSynUpdate added in v9.22.0

func (c AutoPipeliner) FTSynUpdate(ctx context.Context, index string, synGroupId interface{}, terms []interface{}) *StatusCmd

FTSynUpdate - Creates or updates a synonym group with additional terms. The 'index' parameter specifies the index to update, the 'synGroupId' parameter specifies the synonym group id, and the 'terms' parameter specifies the additional terms. For more information, please refer to the Redis documentation: [FT.SYNUPDATE]: (https://redis.io/commands/ft.synupdate/)

func (AutoPipeliner) FTSynUpdateWithArgs added in v9.22.0

func (c AutoPipeliner) FTSynUpdateWithArgs(ctx context.Context, index string, synGroupId interface{}, options *FTSynUpdateOptions, terms []interface{}) *StatusCmd

FTSynUpdateWithArgs - Creates or updates a synonym group with additional terms and options. The 'index' parameter specifies the index to update, the 'synGroupId' parameter specifies the synonym group id, the 'options' parameter specifies additional options for the update, and the 'terms' parameter specifies the additional terms. For more information, please refer to the Redis documentation: [FT.SYNUPDATE]: (https://redis.io/commands/ft.synupdate/)

func (AutoPipeliner) FTTagVals added in v9.22.0

func (c AutoPipeliner) FTTagVals(ctx context.Context, index string, field string) *StringSliceCmd

FTTagVals - Returns all distinct values indexed in a tag field. The 'index' parameter specifies the index to check, and the 'field' parameter specifies the tag field to retrieve values from. For more information, please refer to the Redis documentation: [FT.TAGVALS]: (https://redis.io/commands/ft.tagvals/)

func (AutoPipeliner) FT_List added in v9.22.0

func (c AutoPipeliner) FT_List(ctx context.Context) *StringSliceCmd

FT_List - Lists all the existing indexes in the database. For more information, please refer to the Redis documentation: [FT._LIST]: (https://redis.io/commands/ft._list/)

func (AutoPipeliner) FlushAll added in v9.22.0

func (c AutoPipeliner) FlushAll(ctx context.Context) *StatusCmd

func (AutoPipeliner) FlushAllAsync added in v9.22.0

func (c AutoPipeliner) FlushAllAsync(ctx context.Context) *StatusCmd

func (AutoPipeliner) FlushDB added in v9.22.0

func (c AutoPipeliner) FlushDB(ctx context.Context) *StatusCmd

func (AutoPipeliner) FlushDBAsync added in v9.22.0

func (c AutoPipeliner) FlushDBAsync(ctx context.Context) *StatusCmd

func (AutoPipeliner) FunctionDelete added in v9.22.0

func (c AutoPipeliner) FunctionDelete(ctx context.Context, libName string) *StringCmd

func (AutoPipeliner) FunctionDump added in v9.22.0

func (c AutoPipeliner) FunctionDump(ctx context.Context) *StringCmd

func (AutoPipeliner) FunctionFlush added in v9.22.0

func (c AutoPipeliner) FunctionFlush(ctx context.Context) *StringCmd

func (AutoPipeliner) FunctionFlushAsync added in v9.22.0

func (c AutoPipeliner) FunctionFlushAsync(ctx context.Context) *StringCmd

func (AutoPipeliner) FunctionKill added in v9.22.0

func (c AutoPipeliner) FunctionKill(ctx context.Context) *StringCmd

func (AutoPipeliner) FunctionList added in v9.22.0

func (c AutoPipeliner) FunctionList(ctx context.Context, q FunctionListQuery) *FunctionListCmd

func (AutoPipeliner) FunctionLoad added in v9.22.0

func (c AutoPipeliner) FunctionLoad(ctx context.Context, code string) *StringCmd

func (AutoPipeliner) FunctionLoadReplace added in v9.22.0

func (c AutoPipeliner) FunctionLoadReplace(ctx context.Context, code string) *StringCmd

func (AutoPipeliner) FunctionRestore added in v9.22.0

func (c AutoPipeliner) FunctionRestore(ctx context.Context, libDump string) *StringCmd

func (AutoPipeliner) FunctionStats added in v9.22.0

func (c AutoPipeliner) FunctionStats(ctx context.Context) *FunctionStatsCmd

func (AutoPipeliner) GeoAdd added in v9.22.0

func (c AutoPipeliner) GeoAdd(ctx context.Context, key string, geoLocation ...*GeoLocation) *IntCmd

func (AutoPipeliner) GeoDist added in v9.22.0

func (c AutoPipeliner) GeoDist(
	ctx context.Context, key string, member1, member2, unit string,
) *FloatCmd

func (AutoPipeliner) GeoHash added in v9.22.0

func (c AutoPipeliner) GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd

func (AutoPipeliner) GeoPos added in v9.22.0

func (c AutoPipeliner) GeoPos(ctx context.Context, key string, members ...string) *GeoPosCmd

func (AutoPipeliner) GeoRadius deprecated added in v9.22.0

func (c AutoPipeliner) GeoRadius(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd

GeoRadius queries a geospatial index for members within a distance from a coordinate. This is a read-only variant that does not support Store or StoreDist options.

Deprecated: Use GeoSearch with BYRADIUS argument instead as of Redis 6.2.0.

func (AutoPipeliner) GeoRadiusByMember deprecated added in v9.22.0

func (c AutoPipeliner) GeoRadiusByMember(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd

GeoRadiusByMember queries a geospatial index for members within a distance from a member. This is a read-only variant that does not support Store or StoreDist options.

Deprecated: Use GeoSearch with BYRADIUS and FROMMEMBER arguments instead as of Redis 6.2.0.

func (AutoPipeliner) GeoRadiusByMemberStore added in v9.22.0

func (c AutoPipeliner) GeoRadiusByMemberStore(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (AutoPipeliner) GeoRadiusStore added in v9.22.0

func (c AutoPipeliner) GeoRadiusStore(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (AutoPipeliner) GeoSearch added in v9.22.0

func (c AutoPipeliner) GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd

func (AutoPipeliner) GeoSearchLocation added in v9.22.0

func (c AutoPipeliner) GeoSearchLocation(
	ctx context.Context, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd

func (AutoPipeliner) GeoSearchStore added in v9.22.0

func (c AutoPipeliner) GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd

func (AutoPipeliner) Get added in v9.22.0

func (c AutoPipeliner) Get(ctx context.Context, key string) *StringCmd

Get Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (AutoPipeliner) GetBit added in v9.22.0

func (c AutoPipeliner) GetBit(ctx context.Context, key string, offset int64) *IntCmd

func (AutoPipeliner) GetDel added in v9.22.0

func (c AutoPipeliner) GetDel(ctx context.Context, key string) *StringCmd

GetDel redis-server version >= 6.2.0.

func (AutoPipeliner) GetEx added in v9.22.0

func (c AutoPipeliner) GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.

func (AutoPipeliner) GetRange added in v9.22.0

func (c AutoPipeliner) GetRange(ctx context.Context, key string, start, end int64) *StringCmd

func (AutoPipeliner) GetSet deprecated added in v9.22.0

func (c AutoPipeliner) GetSet(ctx context.Context, key string, value interface{}) *StringCmd

GetSet returns the old value stored at key and sets it to the new value.

Deprecated: Use SetArgs with Get option instead as of Redis 6.2.0.

func (AutoPipeliner) GetToBuffer added in v9.22.0

func (c AutoPipeliner) GetToBuffer(ctx context.Context, key string, buf []byte) *ZeroCopyStringCmd

GetToBuffer executes GET and reads the reply directly into buf, avoiding the intermediate string allocation that *StringCmd would produce. For values larger than the connection's read buffer, the payload is read straight from the socket into buf — effectively zero-copy on the receive path.

The returned *ZeroCopyStringCmd reports the number of bytes read via Val(), the populated slice via Bytes() (which is buf[:Val()]), and any error (including redis.Nil when the key does not exist) via Err(). If buf is too small to hold the value, Err() returns a "buffer too small" error.

Nothing is ever written past len(buf). When len(buf) >= value length + 2, the read takes a fast path that pulls the payload and the protocol's trailing CRLF in a single socket read, using the two bytes after the payload as scratch — size buffers with 2 spare bytes to opt in (see example/zerocopy-buffer).

This command opts out of automatic retries because partial data from a failed attempt would already be sitting in the caller's buffer.

func (AutoPipeliner) HDel added in v9.22.0

func (c AutoPipeliner) HDel(ctx context.Context, key string, fields ...string) *IntCmd

func (AutoPipeliner) HExists added in v9.22.0

func (c AutoPipeliner) HExists(ctx context.Context, key, field string) *BoolCmd

func (AutoPipeliner) HExpire added in v9.22.0

func (c AutoPipeliner) HExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd

HExpire - Sets the expiration time for specified fields in a hash in seconds. The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HEXPIRE Documentation.

func (AutoPipeliner) HExpireAt added in v9.22.0

func (c AutoPipeliner) HExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd

HExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in seconds. Takes a key, a UNIX timestamp, a struct of conditional flags, and a list of fields. The command sets absolute expiration times based on the UNIX timestamp provided. Available since Redis 7.4 CE. For more information refer to HExpireAt Documentation.

func (AutoPipeliner) HExpireAtWithArgs added in v9.22.0

func (c AutoPipeliner) HExpireAtWithArgs(ctx context.Context, key string, tm time.Time, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

func (AutoPipeliner) HExpireTime added in v9.22.0

func (c AutoPipeliner) HExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd

HExpireTime - Retrieves the expiration time for specified fields in a hash as a UNIX timestamp in seconds. Requires a key and the fields themselves to fetch their expiration timestamps. This command returns the expiration times for each field or error/status codes for each field as specified. Available since Redis 7.4 CE. For more information refer to [HExpireTime Documentation].

[HExpireTime Documentation]: https://redis.io/commands/hexpiretime/ For more information - https://redis.io/commands/hexpiretime/

func (AutoPipeliner) HExpireWithArgs added in v9.22.0

func (c AutoPipeliner) HExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

HExpireWithArgs - Sets the expiration time for specified fields in a hash in seconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HEXPIRE Documentation.

func (AutoPipeliner) HGet added in v9.22.0

func (c AutoPipeliner) HGet(ctx context.Context, key, field string) *StringCmd

func (AutoPipeliner) HGetAll added in v9.22.0

func (c AutoPipeliner) HGetAll(ctx context.Context, key string) *MapStringStringCmd

HGetAll returns a map of all fields and values stored at key.

Returns an empty map when key does not exist.

Time complexity: O(N) where N is the size of the hash.

See https://redis.io/commands/hgetall/

func (AutoPipeliner) HGetDel added in v9.22.0

func (c AutoPipeliner) HGetDel(ctx context.Context, key string, fields ...string) *StringSliceCmd

func (AutoPipeliner) HGetEX added in v9.22.0

func (c AutoPipeliner) HGetEX(ctx context.Context, key string, fields ...string) *StringSliceCmd

func (AutoPipeliner) HGetEXWithArgs added in v9.22.0

func (c AutoPipeliner) HGetEXWithArgs(ctx context.Context, key string, options *HGetEXOptions, fields ...string) *StringSliceCmd

func (*AutoPipeliner) HImportDiscard added in v9.22.0

func (ap *AutoPipeliner) HImportDiscard(ctx context.Context, fieldsetName string) *IntCmd

func (*AutoPipeliner) HImportDiscardAll added in v9.22.0

func (ap *AutoPipeliner) HImportDiscardAll(ctx context.Context) *IntCmd

func (*AutoPipeliner) HImportPrepare added in v9.22.0

func (ap *AutoPipeliner) HImportPrepare(ctx context.Context, fieldsetName string, fields ...string) *StatusCmd

HImportPrepare, HImportDiscard and HImportDiscardAll are the remaining cluster-wide overrides (see the delegation note above): ClusterClient fans them out to every master and updates the shared fieldset registry, so running them on a single routed node would let a later HImportSet for a key on another master fail with "no such fieldset". TestAPDelegatesClusterWideOverrides fails if a future ClusterClient override is added without a delegate here.

func (AutoPipeliner) HImportSet added in v9.22.0

func (c AutoPipeliner) HImportSet(ctx context.Context, key, fieldsetName string, values ...interface{}) *StatusCmd

HImportSet creates or fully replaces the hash at key using the field list registered under fieldsetName, pairing values positionally with the prepared fields:

HIMPORT SET key fieldset_name value [value ...]

The number of values must equal the fieldset's field count. The resulting key is a regular hash readable and writable by all hash commands. If the fieldset was registered through HImportPrepare on this client, it is prepared automatically on whichever pooled connection executes the command; otherwise the fieldset must have been prepared on the executing connection or the server replies "ERR no such fieldset".

"no such fieldset" never surfaces for a registered fieldset: a single-command HImportSet whose connection lost its session state (e.g. RESET) is transparently re-prepared and retried once — the failure also stales every other connection's prepared flag, so the retry re-prepares wherever it lands, and this recovery attempt is granted even when retries are disabled (MaxRetries -1). In pipelines the failed HImportSets — and only those — are re-prepared and re-issued once on the same connection (HIMPORT SET is a full replace, so the re-execution is idempotent and no other command of the batch runs again). Inside transactions the error does surface after EXEC — an executed transaction cannot be partially re-run — but the prepared flags are invalidated, so retrying the transaction succeeds.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (AutoPipeliner) HIncrBy added in v9.22.0

func (c AutoPipeliner) HIncrBy(ctx context.Context, key, field string, incr int64) *IntCmd

func (AutoPipeliner) HIncrByFloat added in v9.22.0

func (c AutoPipeliner) HIncrByFloat(ctx context.Context, key, field string, incr float64) *FloatCmd

func (AutoPipeliner) HKeys added in v9.22.0

func (c AutoPipeliner) HKeys(ctx context.Context, key string) *StringSliceCmd

func (AutoPipeliner) HLen added in v9.22.0

func (c AutoPipeliner) HLen(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) HMGet added in v9.22.0

func (c AutoPipeliner) HMGet(ctx context.Context, key string, fields ...string) *SliceCmd

HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.

func (AutoPipeliner) HMSet added in v9.22.0

func (c AutoPipeliner) HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (AutoPipeliner) HPExpire added in v9.22.0

func (c AutoPipeliner) HPExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd

HPExpire - Sets the expiration time for specified fields in a hash in milliseconds. Similar to HExpire, it accepts a key, an expiration duration in milliseconds, a struct with expiration condition flags, and a list of fields. The command modifies the standard time.Duration to milliseconds for the Redis command. Available since Redis 7.4 CE. For more information refer to HPEXPIRE Documentation.

func (AutoPipeliner) HPExpireAt added in v9.22.0

func (c AutoPipeliner) HPExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd

HPExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in milliseconds. Similar to HExpireAt but for timestamps in milliseconds. It accepts the same parameters and adjusts the UNIX time to milliseconds. Available since Redis 7.4 CE. For more information refer to HExpireAt Documentation.

func (AutoPipeliner) HPExpireAtWithArgs added in v9.22.0

func (c AutoPipeliner) HPExpireAtWithArgs(ctx context.Context, key string, tm time.Time, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

func (AutoPipeliner) HPExpireTime added in v9.22.0

func (c AutoPipeliner) HPExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPExpireTime - Retrieves the expiration time for specified fields in a hash as a UNIX timestamp in milliseconds. Similar to HExpireTime, adjusted for timestamps in milliseconds. It requires the same parameters. Provides the expiration timestamp for each field in milliseconds. Available since Redis 7.4 CE. For more information refer to [HExpireTime Documentation].

[HExpireTime Documentation]: https://redis.io/commands/hexpiretime/ For more information - https://redis.io/commands/hexpiretime/

func (AutoPipeliner) HPExpireWithArgs added in v9.22.0

func (c AutoPipeliner) HPExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

HPExpireWithArgs - Sets the expiration time for specified fields in a hash in milliseconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HPEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HPEXPIRE Documentation.

func (AutoPipeliner) HPTTL added in v9.22.0

func (c AutoPipeliner) HPTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPTTL - Retrieves the remaining time to live for specified fields in a hash in milliseconds. Similar to HTTL, but returns the TTL in milliseconds. It requires a key and the specified fields. This command provides the TTL in milliseconds for each field or returns error/status codes as needed. Available since Redis 7.4 CE. For more information refer to [HPTTL Documentation].

[HPTTL Documentation]: https://redis.io/commands/hpttl/ For more information - https://redis.io/commands/hpttl/

func (AutoPipeliner) HPersist added in v9.22.0

func (c AutoPipeliner) HPersist(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPersist - Removes the expiration time from specified fields in a hash. Accepts a key and the fields themselves. This command ensures that each field specified will have its expiration removed if present. Available since Redis 7.4 CE. For more information refer to HPersist Documentation.

func (AutoPipeliner) HRandField added in v9.22.0

func (c AutoPipeliner) HRandField(ctx context.Context, key string, count int) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (AutoPipeliner) HRandFieldWithValues added in v9.22.0

func (c AutoPipeliner) HRandFieldWithValues(ctx context.Context, key string, count int) *KeyValueSliceCmd

HRandFieldWithValues redis-server version >= 6.2.0.

func (AutoPipeliner) HScan added in v9.22.0

func (c AutoPipeliner) HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (AutoPipeliner) HScanNoValues added in v9.22.0

func (c AutoPipeliner) HScanNoValues(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (AutoPipeliner) HSet added in v9.22.0

func (c AutoPipeliner) HSet(ctx context.Context, key string, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet(ctx, "myhash", "key1", "value1", "key2", "value2")

  • HSet(ctx, "myhash", []string{"key1", "value1", "key2", "value2"})

  • HSet(ctx, "myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

    Playing struct With "redis" tag. type MyHash struct { Key1 string `redis:"key1"`; Key2 int `redis:"key2"` }

  • HSet(ctx, "myhash", MyHash{"value1", "value2"}) Warn: redis-server >= 4.0

    For struct, can be a structure pointer type, we only parse the field whose tag is redis. if you don't want the field to be read, you can use the `redis:"-"` flag to ignore it, or you don't need to set the redis tag. For the type of structure field, we only support simple data types: string, int/uint(8,16,32,64), float(32,64), time.Time(to RFC3339Nano), time.Duration(to Nanoseconds ), if you are other more complex or custom data types, please implement the encoding.BinaryMarshaler interface.

Note that in older versions of Redis server(redis-server < 4.0), HSet only supports a single key-value pair. redis-docs: https://redis.io/commands/hset (Starting with Redis version 4.0.0: Accepts multiple field and value arguments.) If you are using a Struct type and the number of fields is greater than one, you will receive an error similar to "ERR wrong number of arguments", you can use HMSet as a substitute.

func (AutoPipeliner) HSetEX added in v9.22.0

func (c AutoPipeliner) HSetEX(ctx context.Context, key string, fieldsAndValues ...string) *IntCmd

func (AutoPipeliner) HSetEXWithArgs added in v9.22.0

func (c AutoPipeliner) HSetEXWithArgs(ctx context.Context, key string, options *HSetEXOptions, fieldsAndValues ...string) *IntCmd

func (AutoPipeliner) HSetNX added in v9.22.0

func (c AutoPipeliner) HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd

func (AutoPipeliner) HStrLen added in v9.22.0

func (c AutoPipeliner) HStrLen(ctx context.Context, key, field string) *IntCmd

func (AutoPipeliner) HTTL added in v9.22.0

func (c AutoPipeliner) HTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd

HTTL - Retrieves the remaining time to live for specified fields in a hash in seconds. Requires a key and the fields themselves. It returns the TTL for each specified field. This command fetches the TTL in seconds for each field or returns error/status codes as appropriate. Available since Redis 7.4 CE. For more information refer to HTTL Documentation.

func (AutoPipeliner) HVals added in v9.22.0

func (c AutoPipeliner) HVals(ctx context.Context, key string) *StringSliceCmd

func (AutoPipeliner) Incr added in v9.22.0

func (c AutoPipeliner) Incr(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) IncrBy added in v9.22.0

func (c AutoPipeliner) IncrBy(ctx context.Context, key string, value int64) *IntCmd

func (AutoPipeliner) IncrByFloat added in v9.22.0

func (c AutoPipeliner) IncrByFloat(ctx context.Context, key string, value float64) *FloatCmd

func (AutoPipeliner) IncrEXFloat added in v9.22.0

func (c AutoPipeliner) IncrEXFloat(ctx context.Context, key string, a IncrEXFloatArgs) *IncrEXFloatCmd

IncrEXFloat Redis `INCREX key [BYFLOAT amount] [LBOUND value] [UBOUND value] [SATURATE] [EX seconds | PX ms | EXAT ts | PXAT ts | PERSIST] [ENX]` command.

Available since Redis 8.8. For more information, see https://redis.io/commands/increx

func (AutoPipeliner) IncrEXInt added in v9.22.0

func (c AutoPipeliner) IncrEXInt(ctx context.Context, key string, a IncrEXIntArgs) *IncrEXIntCmd

IncrEXInt Redis `INCREX key [BYINT amount] [LBOUND value] [UBOUND value] [SATURATE] [EX seconds | PX ms | EXAT ts | PXAT ts | PERSIST] [ENX]` command.

Atomically increments the integer value stored at key, optionally constraining the result to a range and applying expiration semantics. Returns the new value and the increment that was actually applied. When the increment would exceed LBOUND/UBOUND and SATURATE is not set, the key and TTL are left unchanged and the reply is [current_value, 0].

Available since Redis 8.8. For more information, see https://redis.io/commands/increx

func (AutoPipeliner) Info added in v9.22.0

func (c AutoPipeliner) Info(ctx context.Context, sections ...string) *StringCmd

func (AutoPipeliner) InfoMap added in v9.22.0

func (c AutoPipeliner) InfoMap(ctx context.Context, sections ...string) *InfoCmd

func (*AutoPipeliner) IsBlocking added in v9.22.0

func (ap *AutoPipeliner) IsBlocking() bool

IsBlocking reports which face this autopipeliner is: true for the blocking face (Client.AutoPipeline — calls wait for execution), false for the deferred face (AsyncAutoPipeline — calls return immediately and result accessors block). The two faces reject different usage (Submit is blocking-face-rejected), so code handed an *AutoPipeliner can branch on this instead of probing with errors.

func (*AutoPipeliner) IsClosed added in v9.22.0

func (ap *AutoPipeliner) IsClosed() bool

IsClosed reports whether the AutoPipeliner has been closed, either by an explicit Close or by closing the owning client. A closed AutoPipeliner rejects new commands with ErrClosed.

func (AutoPipeliner) JSONArrAppend added in v9.22.0

func (c AutoPipeliner) JSONArrAppend(ctx context.Context, key, path string, values ...interface{}) *IntSliceCmd

JSONArrAppend adds the provided JSON values to the end of the array at the given path. For more information, see https://redis.io/commands/json.arrappend

func (AutoPipeliner) JSONArrIndex added in v9.22.0

func (c AutoPipeliner) JSONArrIndex(ctx context.Context, key, path string, value ...interface{}) *IntSliceCmd

JSONArrIndex searches for the first occurrence of the provided JSON value in the array at the given path. For more information, see https://redis.io/commands/json.arrindex

func (AutoPipeliner) JSONArrIndexWithArgs added in v9.22.0

func (c AutoPipeliner) JSONArrIndexWithArgs(ctx context.Context, key, path string, options *JSONArrIndexArgs, value ...interface{}) *IntSliceCmd

JSONArrIndexWithArgs searches for the first occurrence of a JSON value in an array while allowing the start and stop options to be provided. For more information, see https://redis.io/commands/json.arrindex

func (AutoPipeliner) JSONArrInsert added in v9.22.0

func (c AutoPipeliner) JSONArrInsert(ctx context.Context, key, path string, index int64, values ...interface{}) *IntSliceCmd

JSONArrInsert inserts the JSON values into the array at the specified path before the index (shifts to the right). For more information, see https://redis.io/commands/json.arrinsert

func (AutoPipeliner) JSONArrLen added in v9.22.0

func (c AutoPipeliner) JSONArrLen(ctx context.Context, key, path string) *IntSliceCmd

JSONArrLen reports the length of the JSON array at the specified path in the given key. For more information, see https://redis.io/commands/json.arrlen

func (AutoPipeliner) JSONArrPop added in v9.22.0

func (c AutoPipeliner) JSONArrPop(ctx context.Context, key, path string, index int) *StringSliceCmd

JSONArrPop removes and returns an element from the specified index in the array. For more information, see https://redis.io/commands/json.arrpop

func (AutoPipeliner) JSONArrTrim added in v9.22.0

func (c AutoPipeliner) JSONArrTrim(ctx context.Context, key, path string) *IntSliceCmd

JSONArrTrim trims an array to contain only the specified inclusive range of elements. For more information, see https://redis.io/commands/json.arrtrim

func (AutoPipeliner) JSONArrTrimWithArgs added in v9.22.0

func (c AutoPipeliner) JSONArrTrimWithArgs(ctx context.Context, key, path string, options *JSONArrTrimArgs) *IntSliceCmd

JSONArrTrimWithArgs trims an array to contain only the specified inclusive range of elements. For more information, see https://redis.io/commands/json.arrtrim

func (AutoPipeliner) JSONClear added in v9.22.0

func (c AutoPipeliner) JSONClear(ctx context.Context, key, path string) *IntCmd

JSONClear clears container values (arrays/objects) and sets numeric values to 0. For more information, see https://redis.io/commands/json.clear

func (AutoPipeliner) JSONDebugMemory added in v9.22.0

func (c AutoPipeliner) JSONDebugMemory(ctx context.Context, key, path string) *IntCmd

JSONDebugMemory reports a value's memory usage in bytes (unimplemented) For more information, see https://redis.io/commands/json.debug-memory

func (AutoPipeliner) JSONDel added in v9.22.0

func (c AutoPipeliner) JSONDel(ctx context.Context, key, path string) *IntCmd

JSONDel deletes a value. For more information, see https://redis.io/commands/json.del

func (AutoPipeliner) JSONForget added in v9.22.0

func (c AutoPipeliner) JSONForget(ctx context.Context, key, path string) *IntCmd

JSONForget deletes a value. For more information, see https://redis.io/commands/json.forget

func (AutoPipeliner) JSONGet added in v9.22.0

func (c AutoPipeliner) JSONGet(ctx context.Context, key string, paths ...string) *JSONCmd

JSONGet returns the value at path in JSON serialized form. JSON.GET returns an array of strings. This function parses out the wrapping array but leaves the internal strings unprocessed by default (see Val()) For more information - https://redis.io/commands/json.get/

func (AutoPipeliner) JSONGetWithArgs added in v9.22.0

func (c AutoPipeliner) JSONGetWithArgs(ctx context.Context, key string, options *JSONGetArgs, paths ...string) *JSONCmd

JSONGetWithArgs - Retrieves the value of a key from a JSON document. This function also allows for specifying additional options such as: Indention, NewLine and Space For more information - https://redis.io/commands/json.get/

func (AutoPipeliner) JSONMGet added in v9.22.0

func (c AutoPipeliner) JSONMGet(ctx context.Context, path string, keys ...string) *JSONSliceCmd

JSONMGet returns the values at the specified path from multiple key arguments. Note - the arguments are reversed when compared with `JSON.MGET` as we want to follow the pattern of having the last argument be variable. For more information, see https://redis.io/commands/json.mget

func (AutoPipeliner) JSONMSet added in v9.22.0

func (c AutoPipeliner) JSONMSet(ctx context.Context, params ...interface{}) *StatusCmd

func (AutoPipeliner) JSONMSetArgs added in v9.22.0

func (c AutoPipeliner) JSONMSetArgs(ctx context.Context, docs []JSONSetArgs) *StatusCmd

JSONMSetArgs sets or updates one or more JSON values according to the specified key-path-value triplets. For more information, see https://redis.io/commands/json.mset

func (AutoPipeliner) JSONMerge added in v9.22.0

func (c AutoPipeliner) JSONMerge(ctx context.Context, key, path string, value string) *StatusCmd

JSONMerge merges a given JSON value into matching paths. For more information, see https://redis.io/commands/json.merge

func (AutoPipeliner) JSONNumIncrBy added in v9.22.0

func (c AutoPipeliner) JSONNumIncrBy(ctx context.Context, key, path string, value float64) *JSONCmd

JSONNumIncrBy increments the number value stored at the specified path by the provided number. For more information, see https://redis.io/docs/latest/commands/json.numincrby/

func (AutoPipeliner) JSONObjKeys added in v9.22.0

func (c AutoPipeliner) JSONObjKeys(ctx context.Context, key, path string) *SliceCmd

JSONObjKeys returns the keys in the object that's referenced by the specified path. For more information, see https://redis.io/commands/json.objkeys

func (AutoPipeliner) JSONObjLen added in v9.22.0

func (c AutoPipeliner) JSONObjLen(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONObjLen reports the number of keys in the JSON object at the specified path in the given key. For more information, see https://redis.io/commands/json.objlen

func (AutoPipeliner) JSONSet added in v9.22.0

func (c AutoPipeliner) JSONSet(ctx context.Context, key, path string, value interface{}) *StatusCmd

JSONSet sets the JSON value at the given path in the given key. The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or a []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (AutoPipeliner) JSONSetMode added in v9.22.0

func (c AutoPipeliner) JSONSetMode(ctx context.Context, key, path string, value interface{}, mode string) *StatusCmd

JSONSetMode sets the JSON value at the given path in the given key and allows the mode to be set (the mode value must be "XX" or "NX"). The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (AutoPipeliner) JSONSetWithArgs added in v9.22.0

func (c AutoPipeliner) JSONSetWithArgs(ctx context.Context, key, path string, value interface{}, options *JSONSetArgsOptions) *StatusCmd

JSONSetWithArgs sets the JSON value at the given path in the given key with optional arguments for setting mode (NX/XX) and the FPHA (Floating-Point Homogeneous Array) type used for storing FP arrays. The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (AutoPipeliner) JSONStrAppend added in v9.22.0

func (c AutoPipeliner) JSONStrAppend(ctx context.Context, key, path, value string) *IntPointerSliceCmd

JSONStrAppend appends the JSON-string values to the string at the specified path. For more information, see https://redis.io/commands/json.strappend

func (AutoPipeliner) JSONStrLen added in v9.22.0

func (c AutoPipeliner) JSONStrLen(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONStrLen reports the length of the JSON String at the specified path in the given key. For more information, see https://redis.io/commands/json.strlen

func (AutoPipeliner) JSONToggle added in v9.22.0

func (c AutoPipeliner) JSONToggle(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONToggle toggles a Boolean value stored at the specified path. For more information, see https://redis.io/commands/json.toggle

func (AutoPipeliner) JSONType added in v9.22.0

func (c AutoPipeliner) JSONType(ctx context.Context, key, path string) *JSONSliceCmd

JSONType reports the type of JSON value at the specified path. For more information, see https://redis.io/commands/json.type

func (AutoPipeliner) Keys added in v9.22.0

func (c AutoPipeliner) Keys(ctx context.Context, pattern string) *StringSliceCmd

func (AutoPipeliner) LCS added in v9.22.0

func (c AutoPipeliner) LCS(ctx context.Context, q *LCSQuery) *LCSCmd

func (AutoPipeliner) LIndex added in v9.22.0

func (c AutoPipeliner) LIndex(ctx context.Context, key string, index int64) *StringCmd

func (AutoPipeliner) LInsert added in v9.22.0

func (c AutoPipeliner) LInsert(ctx context.Context, key, op string, pivot, value interface{}) *IntCmd

func (AutoPipeliner) LInsertAfter added in v9.22.0

func (c AutoPipeliner) LInsertAfter(ctx context.Context, key string, pivot, value interface{}) *IntCmd

func (AutoPipeliner) LInsertBefore added in v9.22.0

func (c AutoPipeliner) LInsertBefore(ctx context.Context, key string, pivot, value interface{}) *IntCmd

func (AutoPipeliner) LLen added in v9.22.0

func (c AutoPipeliner) LLen(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) LMPop added in v9.22.0

func (c AutoPipeliner) LMPop(ctx context.Context, direction string, count int64, keys ...string) *KeyValuesCmd

LMPop Pops one or more elements from the first non-empty list key from the list of provided key names. direction: left or right, count: > 0 example: client.LMPop(ctx, "left", 3, "key1", "key2")

func (AutoPipeliner) LMove added in v9.22.0

func (c AutoPipeliner) LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd

func (AutoPipeliner) LMoveM added in v9.22.0

func (c AutoPipeliner) LMoveM(ctx context.Context, source, destination, srcpos, destpos string, a LMoveMArgs) *StringSliceCmd

LMoveM atomically moves multiple elements between lists (Redis 8.10+). srcpos/destpos are "LEFT" or "RIGHT". Returns moved elements, or redis.Nil if none.

func (AutoPipeliner) LPop added in v9.22.0

func (c AutoPipeliner) LPop(ctx context.Context, key string) *StringCmd

func (AutoPipeliner) LPopCount added in v9.22.0

func (c AutoPipeliner) LPopCount(ctx context.Context, key string, count int) *StringSliceCmd

func (AutoPipeliner) LPos added in v9.22.0

func (c AutoPipeliner) LPos(ctx context.Context, key string, value string, a LPosArgs) *IntCmd

func (AutoPipeliner) LPosCount added in v9.22.0

func (c AutoPipeliner) LPosCount(ctx context.Context, key string, value string, count int64, a LPosArgs) *IntSliceCmd

func (AutoPipeliner) LPush added in v9.22.0

func (c AutoPipeliner) LPush(ctx context.Context, key string, values ...interface{}) *IntCmd

func (AutoPipeliner) LPushX added in v9.22.0

func (c AutoPipeliner) LPushX(ctx context.Context, key string, values ...interface{}) *IntCmd

func (AutoPipeliner) LRange added in v9.22.0

func (c AutoPipeliner) LRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

func (AutoPipeliner) LRem added in v9.22.0

func (c AutoPipeliner) LRem(ctx context.Context, key string, count int64, value interface{}) *IntCmd

func (AutoPipeliner) LSet added in v9.22.0

func (c AutoPipeliner) LSet(ctx context.Context, key string, index int64, value interface{}) *StatusCmd

func (AutoPipeliner) LTrim added in v9.22.0

func (c AutoPipeliner) LTrim(ctx context.Context, key string, start, stop int64) *StatusCmd

func (AutoPipeliner) LastSave added in v9.22.0

func (c AutoPipeliner) LastSave(ctx context.Context) *IntCmd

func (AutoPipeliner) Latency added in v9.22.0

func (c AutoPipeliner) Latency(ctx context.Context) *LatencyCmd

func (AutoPipeliner) LatencyReset added in v9.22.0

func (c AutoPipeliner) LatencyReset(ctx context.Context, events ...interface{}) *StatusCmd

func (*AutoPipeliner) Len added in v9.22.0

func (ap *AutoPipeliner) Len() int

Len returns the current number of queued commands across all shards.

func (AutoPipeliner) MGet added in v9.22.0

func (c AutoPipeliner) MGet(ctx context.Context, keys ...string) *SliceCmd

func (AutoPipeliner) MSet added in v9.22.0

func (c AutoPipeliner) MSet(ctx context.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
  • MSet(struct), For struct types, see HSet description.

func (AutoPipeliner) MSetEX added in v9.22.0

func (c AutoPipeliner) MSetEX(ctx context.Context, args MSetEXArgs, values ...interface{}) *IntCmd

MSetEX sets the given keys to their respective values. This command is an extension of the MSETNX that adds expiration and XX options. Available since Redis 8.4 Important: When this method is used with Cluster clients, all keys must be in the same hash slot, otherwise CROSSSLOT error will be returned. For more information, see https://redis.io/commands/msetex

func (AutoPipeliner) MSetNX added in v9.22.0

func (c AutoPipeliner) MSetNX(ctx context.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
  • MSetNX(struct), For struct types, see HSet description.

func (AutoPipeliner) MemoryUsage added in v9.22.0

func (c AutoPipeliner) MemoryUsage(ctx context.Context, key string, samples ...int) *IntCmd

func (AutoPipeliner) Migrate added in v9.22.0

func (c AutoPipeliner) Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd

func (AutoPipeliner) ModuleLoadex added in v9.22.0

func (c AutoPipeliner) ModuleLoadex(ctx context.Context, conf *ModuleLoadexConfig) *StringCmd

ModuleLoadex Redis `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]` command.

func (AutoPipeliner) Monitor added in v9.22.0

func (c AutoPipeliner) Monitor(ctx context.Context, ch chan string) *MonitorCmd

Monitor - represents a Redis MONITOR command, allowing the user to capture and process all commands sent to a Redis server. This mimics the behavior of MONITOR in the redis-cli.

Notes: - Using MONITOR blocks the connection to the server for itself. It needs a dedicated connection - The user should create a channel of type string - This runs concurrently in the background. Trigger via the Start and Stop functions See further: Redis MONITOR command: https://redis.io/commands/monitor

func (AutoPipeliner) Move added in v9.22.0

func (c AutoPipeliner) Move(ctx context.Context, key string, db int) *BoolCmd

func (AutoPipeliner) ObjectEncoding added in v9.22.0

func (c AutoPipeliner) ObjectEncoding(ctx context.Context, key string) *StringCmd

func (AutoPipeliner) ObjectFreq added in v9.22.0

func (c AutoPipeliner) ObjectFreq(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) ObjectIdleTime added in v9.22.0

func (c AutoPipeliner) ObjectIdleTime(ctx context.Context, key string) *DurationCmd

func (AutoPipeliner) ObjectRefCount added in v9.22.0

func (c AutoPipeliner) ObjectRefCount(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) PExpire added in v9.22.0

func (c AutoPipeliner) PExpire(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (AutoPipeliner) PExpireAt added in v9.22.0

func (c AutoPipeliner) PExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd

func (AutoPipeliner) PExpireTime added in v9.22.0

func (c AutoPipeliner) PExpireTime(ctx context.Context, key string) *DurationCmd

PExpireTime returns the absolute expiration time of key as a Unix timestamp encoded in *DurationCmd (milliseconds since the epoch), not a remaining TTL. Convert with: time.UnixMilli(int64(d/time.Millisecond)). Use TTL/PTTL for remaining TTL.

func (AutoPipeliner) PFAdd added in v9.22.0

func (c AutoPipeliner) PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd

func (AutoPipeliner) PFCount added in v9.22.0

func (c AutoPipeliner) PFCount(ctx context.Context, keys ...string) *IntCmd

func (AutoPipeliner) PFMerge added in v9.22.0

func (c AutoPipeliner) PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd

func (*AutoPipeliner) PSubscribe added in v9.22.0

func (ap *AutoPipeliner) PSubscribe(ctx context.Context, channels ...string) *PubSub

PSubscribe opens a pattern pub/sub on the underlying client (not batched).

func (AutoPipeliner) PTTL added in v9.22.0

func (c AutoPipeliner) PTTL(ctx context.Context, key string) *DurationCmd

func (AutoPipeliner) Persist added in v9.22.0

func (c AutoPipeliner) Persist(ctx context.Context, key string) *BoolCmd

func (AutoPipeliner) Ping added in v9.22.0

func (c AutoPipeliner) Ping(ctx context.Context) *StatusCmd

func (*AutoPipeliner) Pipeline added in v9.22.0

func (ap *AutoPipeliner) Pipeline() Pipeliner

Pipeline returns a new pipeline that uses the underlying pipeliner. This allows you to create a traditional pipeline from an autopipeliner.

On a FULL-DUPLEX autopipeliner the pipeline runs on the HELD connection rather than taking one of its own: see fdPipelineExec. Without that, a pipeline built from an autopipeliner would quietly leave the pipe, take a pooled connection per Exec, and lose the coalescing that is the whole point of the engine — measured at 150 active sockets and less than a third of the throughput of the same commands submitted through the engine.

func (*AutoPipeliner) Pipelined added in v9.22.0

func (ap *AutoPipeliner) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)

Pipelined executes a function in a pipeline context. This is a convenience method that creates a pipeline, executes the function, and returns the results.

Uses Pipeline, so on a full-duplex autopipeliner this also runs on the held connection rather than taking one of its own.

func (*AutoPipeliner) PoolStats added in v9.22.0

func (ap *AutoPipeliner) PoolStats() *PoolStats

PoolStats returns the underlying client's connection pool statistics.

func (*AutoPipeliner) Process added in v9.22.0

func (ap *AutoPipeliner) Process(ctx context.Context, cmd Cmder) error

Process queues a command for autopipelined execution, following the autopipeliner's mode like the typed methods and Do: on a blocking autopipeliner the call blocks until the command has executed; on a deferred (async) one it returns immediately and reading the command's result (Val/Result/Err) blocks until its batch is flushed.

func (AutoPipeliner) PubSubChannels added in v9.22.0

func (c AutoPipeliner) PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd

func (AutoPipeliner) PubSubNumPat added in v9.22.0

func (c AutoPipeliner) PubSubNumPat(ctx context.Context) *IntCmd

func (AutoPipeliner) PubSubNumSub added in v9.22.0

func (c AutoPipeliner) PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd

func (AutoPipeliner) PubSubShardChannels added in v9.22.0

func (c AutoPipeliner) PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd

func (AutoPipeliner) PubSubShardNumSub added in v9.22.0

func (c AutoPipeliner) PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd

func (AutoPipeliner) Publish added in v9.22.0

func (c AutoPipeliner) Publish(ctx context.Context, channel string, message interface{}) *IntCmd

Publish posts the message to the channel.

func (AutoPipeliner) Quit deprecated added in v9.22.0

func (c AutoPipeliner) Quit(_ context.Context) *StatusCmd

Quit closes the connection.

Deprecated: Just close the connection instead as of Redis 7.2.0.

func (AutoPipeliner) RPop added in v9.22.0

func (c AutoPipeliner) RPop(ctx context.Context, key string) *StringCmd

func (AutoPipeliner) RPopCount added in v9.22.0

func (c AutoPipeliner) RPopCount(ctx context.Context, key string, count int) *StringSliceCmd

func (AutoPipeliner) RPopLPush deprecated added in v9.22.0

func (c AutoPipeliner) RPopLPush(ctx context.Context, source, destination string) *StringCmd

RPopLPush atomically returns and removes the last element of the source list, and pushes the element as the first element of the destination list.

Deprecated: Use LMove with RIGHT and LEFT arguments instead as of Redis 6.2.0.

func (AutoPipeliner) RPush added in v9.22.0

func (c AutoPipeliner) RPush(ctx context.Context, key string, values ...interface{}) *IntCmd

func (AutoPipeliner) RPushX added in v9.22.0

func (c AutoPipeliner) RPushX(ctx context.Context, key string, values ...interface{}) *IntCmd

func (AutoPipeliner) RandomKey added in v9.22.0

func (c AutoPipeliner) RandomKey(ctx context.Context) *StringCmd

func (AutoPipeliner) ReadOnly added in v9.22.0

func (c AutoPipeliner) ReadOnly(ctx context.Context) *StatusCmd

func (AutoPipeliner) ReadWrite added in v9.22.0

func (c AutoPipeliner) ReadWrite(ctx context.Context) *StatusCmd

func (AutoPipeliner) Rename added in v9.22.0

func (c AutoPipeliner) Rename(ctx context.Context, key, newkey string) *StatusCmd

func (AutoPipeliner) RenameNX added in v9.22.0

func (c AutoPipeliner) RenameNX(ctx context.Context, key, newkey string) *BoolCmd

func (AutoPipeliner) ReplicaOf added in v9.22.0

func (c AutoPipeliner) ReplicaOf(ctx context.Context, host, port string) *StatusCmd

ReplicaOf sets a Redis server as a replica of another, or promotes it to being a master.

func (AutoPipeliner) Restore added in v9.22.0

func (c AutoPipeliner) Restore(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd

func (AutoPipeliner) RestoreReplace added in v9.22.0

func (c AutoPipeliner) RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd

func (AutoPipeliner) SAdd added in v9.22.0

func (c AutoPipeliner) SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd

Returns the number of elements that were added to the set, not including all the elements already present in the set.

For more information about the command please refer to [SADD].

[SADD]: (https://redis.io/docs/latest/commands/sadd/)

func (AutoPipeliner) SCard added in v9.22.0

func (c AutoPipeliner) SCard(ctx context.Context, key string) *IntCmd

Returns the set cardinality (number of elements) of the set stored at key. Returns 0 if key does not exist.

For more information about the command please refer to [SCARD].

[SCARD]: (https://redis.io/docs/latest/commands/scard/)

func (AutoPipeliner) SDiff added in v9.22.0

func (c AutoPipeliner) SDiff(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the difference between the first set and all the successive sets. Keys that do not exist are considered to be empty sets.

For more information about the command please refer to [SDIFF].

[SDIFF]: (https://redis.io/docs/latest/commands/sdiff/)

func (AutoPipeliner) SDiffCard added in v9.22.0

func (c AutoPipeliner) SDiffCard(ctx context.Context, opts *SDiffCardOptions, keys ...string) *IntCmd

Returns the cardinality of the difference of the first set and the rest. Missing keys are treated as empty sets.

For more information about the command please refer to [SDIFFCARD].

[SDIFFCARD]: (https://redis.io/docs/latest/commands/sdiffcard/)

func (AutoPipeliner) SDiffStore added in v9.22.0

func (c AutoPipeliner) SDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the difference between the first set and all the successive sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SDIFFSTORE].

[SDIFFSTORE]: (https://redis.io/docs/latest/commands/sdiffstore/)

func (AutoPipeliner) SInter added in v9.22.0

func (c AutoPipeliner) SInter(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the intersection of all the given sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty.

For more information about the command please refer to [SINTER].

[SINTER]: (https://redis.io/docs/latest/commands/sinter/)

func (AutoPipeliner) SInterCard added in v9.22.0

func (c AutoPipeliner) SInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd

Returns the cardinality of the set resulting from the intersection of all the given sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty.

The limit parameter sets an upper bound on the number of results returned. If limit is 0, no limit is applied.

For more information about the command please refer to [SINTERCARD].

[SINTERCARD]: (https://redis.io/docs/latest/commands/sintercard/)

func (AutoPipeliner) SInterStore added in v9.22.0

func (c AutoPipeliner) SInterStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the intersection of all the given sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SINTERSTORE].

[SINTERSTORE]: (https://redis.io/docs/latest/commands/sinterstore/)

func (AutoPipeliner) SIsMember added in v9.22.0

func (c AutoPipeliner) SIsMember(ctx context.Context, key string, member interface{}) *BoolCmd

Returns if member is a member of the set stored at key. Returns true if the element is a member of the set, false if it is not a member or if key does not exist.

For more information about the command please refer to [SISMEMBER].

[SISMEMBER]: (https://redis.io/docs/latest/commands/sismember/)

func (AutoPipeliner) SMIsMember added in v9.22.0

func (c AutoPipeliner) SMIsMember(ctx context.Context, key string, members ...interface{}) *BoolSliceCmd

Returns whether each member is a member of the set stored at key. For each member, returns true if the element is a member of the set, false if it is not a member or if key does not exist.

For more information about the command please refer to [SMISMEMBER].

[SMISMEMBER]: (https://redis.io/docs/latest/commands/smismember/)

func (AutoPipeliner) SMembers added in v9.22.0

func (c AutoPipeliner) SMembers(ctx context.Context, key string) *StringSliceCmd

Returns all the members of the set value stored at key. Returns an empty slice if key does not exist.

For more information about the command please refer to [SMEMBERS].

[SMEMBERS]: (https://redis.io/docs/latest/commands/smembers/)

func (AutoPipeliner) SMembersMap added in v9.22.0

func (c AutoPipeliner) SMembersMap(ctx context.Context, key string) *StringStructMapCmd

Returns all the members of the set value stored at key as a map. Returns an empty map if key does not exist.

For more information about the command please refer to [SMEMBERS].

[SMEMBERS]: (https://redis.io/docs/latest/commands/smembers/)

func (AutoPipeliner) SMove added in v9.22.0

func (c AutoPipeliner) SMove(ctx context.Context, source, destination string, member interface{}) *BoolCmd

Moves member from the set at source to the set at destination. This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients.

For more information about the command please refer to [SMOVE].

[SMOVE]: (https://redis.io/docs/latest/commands/smove/)

func (AutoPipeliner) SPop added in v9.22.0

func (c AutoPipeliner) SPop(ctx context.Context, key string) *StringCmd

Removes and returns one or more random members from the set value stored at key. This version returns a single random member.

For more information about the command please refer to [SPOP].

[SPOP]: (https://redis.io/docs/latest/commands/spop/)

func (AutoPipeliner) SPopN added in v9.22.0

func (c AutoPipeliner) SPopN(ctx context.Context, key string, count int64) *StringSliceCmd

Removes and returns one or more random members from the set value stored at key. This version returns up to count random members.

For more information about the command please refer to [SPOP].

[SPOP]: (https://redis.io/docs/latest/commands/spop/)

func (AutoPipeliner) SPublish added in v9.22.0

func (c AutoPipeliner) SPublish(ctx context.Context, channel string, message interface{}) *IntCmd

func (AutoPipeliner) SRandMember added in v9.22.0

func (c AutoPipeliner) SRandMember(ctx context.Context, key string) *StringCmd

Returns a random member from the set value stored at key. This version returns a single random member without removing it.

For more information about the command please refer to [SRANDMEMBER].

[SRANDMEMBER]: (https://redis.io/docs/latest/commands/srandmember/)

func (AutoPipeliner) SRandMemberN added in v9.22.0

func (c AutoPipeliner) SRandMemberN(ctx context.Context, key string, count int64) *StringSliceCmd

Returns an array of random members from the set value stored at key. This version returns up to count random members without removing them. When called with a positive count, returns distinct elements. When called with a negative count, allows for repeated elements.

For more information about the command please refer to [SRANDMEMBER].

[SRANDMEMBER]: (https://redis.io/docs/latest/commands/srandmember/)

func (AutoPipeliner) SRem added in v9.22.0

func (c AutoPipeliner) SRem(ctx context.Context, key string, members ...interface{}) *IntCmd

Removes the specified members from the set stored at key. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.

For more information about the command please refer to [SREM].

[SREM]: (https://redis.io/docs/latest/commands/srem/)

func (AutoPipeliner) SScan added in v9.22.0

func (c AutoPipeliner) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

Incrementally iterates the set elements stored at key. This is a cursor-based iterator that allows scanning large sets efficiently.

Parameters:

  • cursor: The cursor value for the iteration (use 0 to start a new scan)
  • match: Optional pattern to match elements (empty string means no pattern)
  • count: Optional hint about how many elements to return per iteration

For more information about the command please refer to [SSCAN].

[SSCAN]: (https://redis.io/docs/latest/commands/sscan/)

func (*AutoPipeliner) SSubscribe added in v9.22.0

func (ap *AutoPipeliner) SSubscribe(ctx context.Context, channels ...string) *PubSub

SSubscribe opens a sharded pub/sub on the underlying client (not batched).

func (AutoPipeliner) SUnion added in v9.22.0

func (c AutoPipeliner) SUnion(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the union of all the given sets. Keys that do not exist are considered to be empty sets.

For more information about the command please refer to [SUNION].

[SUNION]: (https://redis.io/docs/latest/commands/sunion/)

func (AutoPipeliner) SUnionCard added in v9.22.0

func (c AutoPipeliner) SUnionCard(ctx context.Context, opts *SUnionCardOptions, keys ...string) *IntCmd

Returns the cardinality of the union of all the given sets. Missing keys are treated as empty sets.

For more information about the command please refer to [SUNIONCARD].

[SUNIONCARD]: (https://redis.io/docs/latest/commands/sunioncard/)

func (AutoPipeliner) SUnionStore added in v9.22.0

func (c AutoPipeliner) SUnionStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the union of all the given sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SUNIONSTORE].

[SUNIONSTORE]: (https://redis.io/docs/latest/commands/sunionstore/)

func (AutoPipeliner) Save added in v9.22.0

func (c AutoPipeliner) Save(ctx context.Context) *StatusCmd

func (AutoPipeliner) Scan added in v9.22.0

func (c AutoPipeliner) Scan(ctx context.Context, cursor uint64, match string, count int64) *ScanCmd

func (AutoPipeliner) ScanType added in v9.22.0

func (c AutoPipeliner) ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) *ScanCmd

func (*AutoPipeliner) ScriptExists added in v9.22.0

func (ap *AutoPipeliner) ScriptExists(ctx context.Context, hashes ...string) *BoolSliceCmd

ScriptExists delegates to the underlying client (ANDs results across shards on ClusterClient).

func (*AutoPipeliner) ScriptFlush added in v9.22.0

func (ap *AutoPipeliner) ScriptFlush(ctx context.Context) *StatusCmd

ScriptFlush delegates to the underlying client (flushes every shard on ClusterClient).

func (AutoPipeliner) ScriptKill added in v9.22.0

func (c AutoPipeliner) ScriptKill(ctx context.Context) *StatusCmd

func (*AutoPipeliner) ScriptLoad added in v9.22.0

func (ap *AutoPipeliner) ScriptLoad(ctx context.Context, script string) *StringCmd

ScriptLoad delegates to the underlying client (loads every shard on ClusterClient).

func (AutoPipeliner) Set added in v9.22.0

func (c AutoPipeliner) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

Set Redis `SET key value [expiration]` command. Use expiration for `SETEx`-like behavior.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (AutoPipeliner) SetArgs added in v9.22.0

func (c AutoPipeliner) SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.

func (AutoPipeliner) SetBit added in v9.22.0

func (c AutoPipeliner) SetBit(ctx context.Context, key string, offset int64, value int) *IntCmd

func (AutoPipeliner) SetEx deprecated added in v9.22.0

func (c AutoPipeliner) SetEx(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

SetEx sets the value and expiration of a key.

Deprecated: Use Set with expiration instead as of Redis 2.6.12.

func (AutoPipeliner) SetFromBuffer added in v9.22.0

func (c AutoPipeliner) SetFromBuffer(ctx context.Context, key string, buf []byte) *StatusCmd

SetFromBuffer executes SET writing the value directly from buf. For values larger than the connection's write buffer, bufio.Writer.Write flushes its internal buffer (containing the RESP header) and then writes buf straight to the socket — effectively zero-copy on the send path.

Expiration is not supported; use Expire separately if a TTL is required.

Note: SetFromBuffer is exposed for API symmetry with GetToBuffer and is functionally equivalent to Set(ctx, key, buf, 0) — both dispatch to the same []byte case in the RESP writer and produce identical bytes on the wire. The zero-copy property on the send path comes from bufio.Writer.Write bypassing its internal buffer for large payloads, which Set([]byte) gets automatically. Prefer SetFromBuffer in code that also uses GetToBuffer so the buffer-based pattern reads coherently; otherwise Set(ctx, key, buf, 0) is equally efficient.

func (AutoPipeliner) SetIFDEQ added in v9.22.0

func (c AutoPipeliner) SetIFDEQ(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StatusCmd

SetIFDEQ sets the value only if the current value's digest equals matchDigest.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns "OK" on success. Returns redis.Nil if the digest doesn't match (value was modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFNEQ is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFDEQGet added in v9.22.0

func (c AutoPipeliner) SetIFDEQGet(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StringCmd

SetIFDEQGet sets the value only if the current value's digest equals matchDigest, and returns the previous value.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns the previous value on success. Returns redis.Nil if the digest doesn't match (value was modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFNEQGet is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFDNE added in v9.22.0

func (c AutoPipeliner) SetIFDNE(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StatusCmd

SetIFDNE sets the value only if the current value's digest does NOT equal matchDigest.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns "OK" on success (digest didn't match, value was set). Returns redis.Nil if the digest matches (value was not modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFDNE is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFDNEGet added in v9.22.0

func (c AutoPipeliner) SetIFDNEGet(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StringCmd

SetIFDNEGet sets the value only if the current value's digest does NOT equal matchDigest, and returns the previous value.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns the previous value on success (digest didn't match, value was set). Returns redis.Nil if the digest matches (value was not modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFDNEGet is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFEQ added in v9.22.0

func (c AutoPipeliner) SetIFEQ(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd

SetIFEQ Redis `SET key value [expiration] IFEQ match-value` command. Compare-and-set: only sets the value if the current value equals matchValue.

Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFEQ is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFEQGet added in v9.22.0

func (c AutoPipeliner) SetIFEQGet(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StringCmd

SetIFEQGet Redis `SET key value [expiration] IFEQ match-value GET` command. Compare-and-set with GET: only sets the value if the current value equals matchValue, and returns the previous value.

Returns the previous value on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFEQGet is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFNE added in v9.22.0

func (c AutoPipeliner) SetIFNE(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd

SetIFNE Redis `SET key value [expiration] IFNE match-value` command. Compare-and-set: only sets the value if the current value does not equal matchValue.

Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFNE is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetIFNEGet added in v9.22.0

func (c AutoPipeliner) SetIFNEGet(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StringCmd

SetIFNEGet Redis `SET key value [expiration] IFNE match-value GET` command. Compare-and-set with GET: only sets the value if the current value does not equal matchValue, and returns the previous value.

Returns the previous value on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFNEGet is still experimental it's signature and behaviour may change

func (AutoPipeliner) SetNX added in v9.22.0

func (c AutoPipeliner) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd

SetNX sets the value of a key only if the key does not exist.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (AutoPipeliner) SetRange added in v9.22.0

func (c AutoPipeliner) SetRange(ctx context.Context, key string, offset int64, value string) *IntCmd

func (AutoPipeliner) SetXX added in v9.22.0

func (c AutoPipeliner) SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd

SetXX Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (AutoPipeliner) Shutdown added in v9.22.0

func (c AutoPipeliner) Shutdown(ctx context.Context) *StatusCmd

func (AutoPipeliner) ShutdownNoSave added in v9.22.0

func (c AutoPipeliner) ShutdownNoSave(ctx context.Context) *StatusCmd

func (AutoPipeliner) ShutdownSave added in v9.22.0

func (c AutoPipeliner) ShutdownSave(ctx context.Context) *StatusCmd

func (AutoPipeliner) SlaveOf deprecated added in v9.22.0

func (c AutoPipeliner) SlaveOf(ctx context.Context, host, port string) *StatusCmd

SlaveOf sets a Redis server as a replica of another, or promotes it to being a master.

Deprecated: Use ReplicaOf instead as of Redis 5.0.0.

func (AutoPipeliner) SlowLogGet added in v9.22.0

func (c AutoPipeliner) SlowLogGet(ctx context.Context, num int64) *SlowLogCmd

func (AutoPipeliner) SlowLogLen added in v9.22.0

func (c AutoPipeliner) SlowLogLen(ctx context.Context) *IntCmd

func (AutoPipeliner) SlowLogReset added in v9.22.0

func (c AutoPipeliner) SlowLogReset(ctx context.Context) *StatusCmd

func (AutoPipeliner) Sort added in v9.22.0

func (c AutoPipeliner) Sort(ctx context.Context, key string, sort *Sort) *StringSliceCmd

func (AutoPipeliner) SortInterfaces added in v9.22.0

func (c AutoPipeliner) SortInterfaces(ctx context.Context, key string, sort *Sort) *SliceCmd

func (AutoPipeliner) SortRO added in v9.22.0

func (c AutoPipeliner) SortRO(ctx context.Context, key string, sort *Sort) *StringSliceCmd

func (AutoPipeliner) SortStore added in v9.22.0

func (c AutoPipeliner) SortStore(ctx context.Context, key, store string, sort *Sort) *IntCmd

func (AutoPipeliner) StrLen added in v9.22.0

func (c AutoPipeliner) StrLen(ctx context.Context, key string) *IntCmd

func (*AutoPipeliner) Submit added in v9.22.0

func (ap *AutoPipeliner) Submit(ctx context.Context, cmd Cmder) AutoFuture

Submit queues a command without blocking and returns an AutoFuture; Wait on it when the result is needed. This is the explicit form for working with raw Cmders on the deferred (async) face, where the typed methods (Set, Get, ...) provide the same deferred behaviour returning the usual *XxxCmd. The command's own result accessors (Err/Val/Result) are safe to use instead of Wait — they block until the command has executed. Connection-hostile command names (SHUTDOWN, MONITOR, SELECT, AUTH, MULTI, SUBSCRIBE, CLIENT, ...) never ride a shared pipeline connection: they are diverted to a normal pooled connection with plain Client.Do semantics. On a BLOCKING autopipeliner Submit is rejected (the future's Wait returns an error): the blocking face's ordering relies on every caller waiting for each command before issuing the next, which Submit by design does not do.

func (*AutoPipeliner) Subscribe added in v9.22.0

func (ap *AutoPipeliner) Subscribe(ctx context.Context, channels ...string) *PubSub

Subscribe opens a pub/sub on the underlying client (not batched — pub/sub needs a dedicated connection).

func (AutoPipeliner) Sync added in v9.22.0

func (c AutoPipeliner) Sync(_ context.Context)

func (AutoPipeliner) TDigestAdd added in v9.22.0

func (c AutoPipeliner) TDigestAdd(ctx context.Context, key string, elements ...float64) *StatusCmd

TDigestAdd adds one or more elements to a t-Digest data structure. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.add/

func (AutoPipeliner) TDigestByRank added in v9.22.0

func (c AutoPipeliner) TDigestByRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd

TDigestByRank returns an array of values from a t-Digest data structure based on their rank. The rank of an element is its position in the sorted list of all elements in the t-Digest. Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.byrank/

func (AutoPipeliner) TDigestByRevRank added in v9.22.0

func (c AutoPipeliner) TDigestByRevRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd

TDigestByRevRank returns an array of values from a t-Digest data structure based on their reverse rank. The reverse rank of an element is its position in the sorted list of all elements in the t-Digest when sorted in descending order. Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.byrevrank/

func (AutoPipeliner) TDigestCDF added in v9.22.0

func (c AutoPipeliner) TDigestCDF(ctx context.Context, key string, elements ...float64) *FloatSliceCmd

TDigestCDF returns an array of cumulative distribution function (CDF) values for one or more elements in a t-Digest data structure. The CDF value for an element is the fraction of all elements in the t-Digest that are less than or equal to it. Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.cdf/

func (AutoPipeliner) TDigestCreate added in v9.22.0

func (c AutoPipeliner) TDigestCreate(ctx context.Context, key string) *StatusCmd

TDigestCreate creates an empty t-Digest data structure with default parameters. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.create/

func (AutoPipeliner) TDigestCreateWithCompression added in v9.22.0

func (c AutoPipeliner) TDigestCreateWithCompression(ctx context.Context, key string, compression int64) *StatusCmd

TDigestCreateWithCompression creates an empty t-Digest data structure with a specified compression parameter. The compression parameter controls the accuracy and memory usage of the t-Digest. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.create/

func (AutoPipeliner) TDigestInfo added in v9.22.0

func (c AutoPipeliner) TDigestInfo(ctx context.Context, key string) *TDigestInfoCmd

TDigestInfo returns information about a t-Digest data structure. For more information - https://redis.io/commands/tdigest.info/

func (AutoPipeliner) TDigestMax added in v9.22.0

func (c AutoPipeliner) TDigestMax(ctx context.Context, key string) *FloatCmd

TDigestMax returns the maximum value from a t-Digest data structure. For more information - https://redis.io/commands/tdigest.max/

func (AutoPipeliner) TDigestMerge added in v9.22.0

func (c AutoPipeliner) TDigestMerge(ctx context.Context, destKey string, options *TDigestMergeOptions, sourceKeys ...string) *StatusCmd

TDigestMerge merges multiple t-Digest data structures into a single t-Digest. This function also allows for specifying additional options such as compression and override behavior. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.merge/

func (AutoPipeliner) TDigestMin added in v9.22.0

func (c AutoPipeliner) TDigestMin(ctx context.Context, key string) *FloatCmd

TDigestMin returns the minimum value from a t-Digest data structure. For more information - https://redis.io/commands/tdigest.min/

func (AutoPipeliner) TDigestQuantile added in v9.22.0

func (c AutoPipeliner) TDigestQuantile(ctx context.Context, key string, elements ...float64) *FloatSliceCmd

TDigestQuantile returns an array of quantile values for one or more elements in a t-Digest data structure. The quantile value for an element is the fraction of all elements in the t-Digest that are less than or equal to it. Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.quantile/

func (AutoPipeliner) TDigestRank added in v9.22.0

func (c AutoPipeliner) TDigestRank(ctx context.Context, key string, values ...float64) *IntSliceCmd

TDigestRank returns an array of rank values for one or more elements in a t-Digest data structure. The rank of an element is its position in the sorted list of all elements in the t-Digest. Returns an array of integers representing the rank values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.rank/

func (AutoPipeliner) TDigestReset added in v9.22.0

func (c AutoPipeliner) TDigestReset(ctx context.Context, key string) *StatusCmd

TDigestReset resets a t-Digest data structure to its initial state. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.reset/

func (AutoPipeliner) TDigestRevRank added in v9.22.0

func (c AutoPipeliner) TDigestRevRank(ctx context.Context, key string, values ...float64) *IntSliceCmd

TDigestRevRank returns an array of reverse rank values for one or more elements in a t-Digest data structure. The reverse rank of an element is its position in the sorted list of all elements in the t-Digest when sorted in descending order. Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.revrank/

func (AutoPipeliner) TDigestTrimmedMean added in v9.22.0

func (c AutoPipeliner) TDigestTrimmedMean(ctx context.Context, key string, lowCutQuantile, highCutQuantile float64) *FloatCmd

TDigestTrimmedMean returns the trimmed mean value from a t-Digest data structure. The trimmed mean is calculated by removing a specified fraction of the highest and lowest values from the t-Digest and then calculating the mean of the remaining values. Returns a float representing the trimmed mean value or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.trimmed_mean/

func (AutoPipeliner) TSAdd added in v9.22.0

func (c AutoPipeliner) TSAdd(ctx context.Context, key string, timestamp interface{}, value float64) *IntCmd

TSAdd - Adds one or more observations to a t-digest sketch. For more information - https://redis.io/commands/ts.add/

func (AutoPipeliner) TSAddWithArgs added in v9.22.0

func (c AutoPipeliner) TSAddWithArgs(ctx context.Context, key string, timestamp interface{}, value float64, options *TSOptions) *IntCmd

TSAddWithArgs - Adds one or more observations to a t-digest sketch. This function also allows for specifying additional options such as: Retention, ChunkSize, Encoding, DuplicatePolicy and Labels. For more information - https://redis.io/commands/ts.add/

func (AutoPipeliner) TSAlter added in v9.22.0

func (c AutoPipeliner) TSAlter(ctx context.Context, key string, options *TSAlterOptions) *StatusCmd

TSAlter - Alters an existing time-series key with additional options. This function allows for specifying additional options such as: Retention, ChunkSize and DuplicatePolicy. For more information - https://redis.io/commands/ts.alter/

func (AutoPipeliner) TSCreate added in v9.22.0

func (c AutoPipeliner) TSCreate(ctx context.Context, key string) *StatusCmd

TSCreate - Creates a new time-series key. For more information - https://redis.io/commands/ts.create/

func (AutoPipeliner) TSCreateRule added in v9.22.0

func (c AutoPipeliner) TSCreateRule(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd

TSCreateRule - Creates a compaction rule from sourceKey to destKey. For more information - https://redis.io/commands/ts.createrule/

func (AutoPipeliner) TSCreateRuleWithArgs added in v9.22.0

func (c AutoPipeliner) TSCreateRuleWithArgs(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd

TSCreateRuleWithArgs - Creates a compaction rule from sourceKey to destKey with additional option. This function allows for specifying additional option such as: alignTimestamp. For more information - https://redis.io/commands/ts.createrule/

func (AutoPipeliner) TSCreateWithArgs added in v9.22.0

func (c AutoPipeliner) TSCreateWithArgs(ctx context.Context, key string, options *TSOptions) *StatusCmd

TSCreateWithArgs - Creates a new time-series key with additional options. This function allows for specifying additional options such as: Retention, ChunkSize, Encoding, DuplicatePolicy and Labels. For more information - https://redis.io/commands/ts.create/

func (AutoPipeliner) TSDecrBy added in v9.22.0

func (c AutoPipeliner) TSDecrBy(ctx context.Context, Key string, timestamp float64) *IntCmd

TSDecrBy - Decrements the value of a time-series key by the specified timestamp. For more information - https://redis.io/commands/ts.decrby/

func (AutoPipeliner) TSDecrByWithArgs added in v9.22.0

func (c AutoPipeliner) TSDecrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd

TSDecrByWithArgs - Decrements the value of a time-series key by the specified timestamp with additional options. This function allows for specifying additional options such as: Timestamp, Retention, ChunkSize, Uncompressed and Labels. For more information - https://redis.io/commands/ts.decrby/

func (AutoPipeliner) TSDel added in v9.22.0

func (c AutoPipeliner) TSDel(ctx context.Context, Key string, fromTimestamp int, toTimestamp int) *IntCmd

TSDel - Deletes a range of samples from a time-series key. For more information - https://redis.io/commands/ts.del/

func (AutoPipeliner) TSDeleteRule added in v9.22.0

func (c AutoPipeliner) TSDeleteRule(ctx context.Context, sourceKey string, destKey string) *StatusCmd

TSDeleteRule - Deletes a compaction rule from sourceKey to destKey. For more information - https://redis.io/commands/ts.deleterule/

func (AutoPipeliner) TSGet added in v9.22.0

func (c AutoPipeliner) TSGet(ctx context.Context, key string) *TSTimestampValueCmd

TSGet - Gets the last sample of a time-series key. For more information - https://redis.io/commands/ts.get/

func (AutoPipeliner) TSGetWithArgs added in v9.22.0

func (c AutoPipeliner) TSGetWithArgs(ctx context.Context, key string, options *TSGetOptions) *TSTimestampValueCmd

TSGetWithArgs - Gets the last sample of a time-series key with additional option. This function allows for specifying additional option such as: Latest. For more information - https://redis.io/commands/ts.get/

func (AutoPipeliner) TSIncrBy added in v9.22.0

func (c AutoPipeliner) TSIncrBy(ctx context.Context, Key string, timestamp float64) *IntCmd

TSIncrBy - Increments the value of a time-series key by the specified timestamp. For more information - https://redis.io/commands/ts.incrby/

func (AutoPipeliner) TSIncrByWithArgs added in v9.22.0

func (c AutoPipeliner) TSIncrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd

TSIncrByWithArgs - Increments the value of a time-series key by the specified timestamp with additional options. This function allows for specifying additional options such as: Timestamp, Retention, ChunkSize, Uncompressed and Labels. For more information - https://redis.io/commands/ts.incrby/

func (AutoPipeliner) TSInfo added in v9.22.0

func (c AutoPipeliner) TSInfo(ctx context.Context, key string) *MapStringInterfaceCmd

TSInfo - Returns information about a time-series key. For more information - https://redis.io/commands/ts.info/

func (AutoPipeliner) TSInfoWithArgs added in v9.22.0

func (c AutoPipeliner) TSInfoWithArgs(ctx context.Context, key string, options *TSInfoOptions) *MapStringInterfaceCmd

TSInfoWithArgs - Returns information about a time-series key with additional option. This function allows for specifying additional option such as: Debug. For more information - https://redis.io/commands/ts.info/

func (AutoPipeliner) TSMAdd added in v9.22.0

func (c AutoPipeliner) TSMAdd(ctx context.Context, ktvSlices [][]interface{}) *IntSliceCmd

TSMAdd - Adds multiple samples to multiple time-series keys. It accepts a slice of 'ktv' slices, each containing exactly three elements: key, timestamp, and value. This struct must be provided for this command to work. For more information - https://redis.io/commands/ts.madd/

func (AutoPipeliner) TSMGet added in v9.22.0

func (c AutoPipeliner) TSMGet(ctx context.Context, filters []string) *MapStringSliceInterfaceCmd

TSMGet - Returns the last sample of multiple time-series keys. For more information - https://redis.io/commands/ts.mget/

func (AutoPipeliner) TSMGetWithArgs added in v9.22.0

func (c AutoPipeliner) TSMGetWithArgs(ctx context.Context, filters []string, options *TSMGetOptions) *MapStringSliceInterfaceCmd

TSMGetWithArgs - Returns the last sample of multiple time-series keys with additional options. This function allows for specifying additional options such as: Latest, WithLabels and SelectedLabels. For more information - https://redis.io/commands/ts.mget/

func (AutoPipeliner) TSMRange added in v9.22.0

func (c AutoPipeliner) TSMRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd

TSMRange - Returns a range of samples from multiple time-series keys. For more information - https://redis.io/commands/ts.mrange/

func (AutoPipeliner) TSMRangeWithArgs added in v9.22.0

func (c AutoPipeliner) TSMRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd

TSMRangeWithArgs - Returns a range of samples from multiple time-series keys. Options are set via TSMRangeOptions. For more information - https://redis.io/commands/ts.mrange/

func (AutoPipeliner) TSMRevRange added in v9.22.0

func (c AutoPipeliner) TSMRevRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd

TSMRevRange - Returns a range of samples from multiple time-series keys in reverse order. For more information - https://redis.io/commands/ts.mrevrange/

func (AutoPipeliner) TSMRevRangeWithArgs added in v9.22.0

func (c AutoPipeliner) TSMRevRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd

TSMRevRangeWithArgs - Returns a range of samples from multiple time-series keys in reverse order. Options are set via TSMRevRangeOptions. For more information - https://redis.io/commands/ts.mrevrange/

func (AutoPipeliner) TSNRange added in v9.22.0

func (c AutoPipeliner) TSNRange(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}) *TSNRangePivotRowSliceCmd

TSNRange - Queries multiple time-series keys and returns a pivot response in forward (ascending) order. For more information - https://redis.io/commands/ts.nrange/

func (AutoPipeliner) TSNRangeWithArgs added in v9.22.0

func (c AutoPipeliner) TSNRangeWithArgs(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}, options *TSNRangeOptions) *TSNRangePivotRowSliceCmd

TSNRangeWithArgs - Queries multiple time-series keys and returns a pivot response in forward (ascending) order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregators, BucketDuration, BucketTimestamp and Empty. Aggregators must contain exactly one spec per key; each spec lists one or more aggregators for its key and is emitted as a single comma-joined wire token. For more information - https://redis.io/commands/ts.nrange/

func (AutoPipeliner) TSNRevRange added in v9.22.0

func (c AutoPipeliner) TSNRevRange(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}) *TSNRangePivotRowSliceCmd

TSNRevRange - Queries multiple time-series keys and returns a pivot response in reverse (descending) order. For more information - https://redis.io/commands/ts.nrevrange/

func (AutoPipeliner) TSNRevRangeWithArgs added in v9.22.0

func (c AutoPipeliner) TSNRevRangeWithArgs(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}, options *TSNRevRangeOptions) *TSNRangePivotRowSliceCmd

TSNRevRangeWithArgs - Queries multiple time-series keys and returns a pivot response in reverse (descending) order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregators, BucketDuration, BucketTimestamp and Empty. Aggregators must contain exactly one spec per key; each spec lists one or more aggregators for its key and is emitted as a single comma-joined wire token. For more information - https://redis.io/commands/ts.nrevrange/

func (AutoPipeliner) TSQueryIndex added in v9.22.0

func (c AutoPipeliner) TSQueryIndex(ctx context.Context, filterExpr []string) *StringSliceCmd

TSQueryIndex - Returns all the keys matching the filter expression. For more information - https://redis.io/commands/ts.queryindex/

func (AutoPipeliner) TSQueryLabelValues added in v9.22.0

func (c AutoPipeliner) TSQueryLabelValues(ctx context.Context, label string, filterExpr []string) *StringSliceCmd

TSQueryLabelValues - Returns the set of values assigned to the given label name across the time series matching the filter expressions. Passing no filter expressions queries all indexed series. The label name is matched byte-exactly; a label present on no matching series yields an empty reply, not an error. The reply is unordered and already deduplicated by the server. filterExpr uses the same filter language as TSQueryIndex and is passed to the server verbatim. Available since Redis 8.10. For more information - https://redis.io/commands/ts.querylabels/

func (AutoPipeliner) TSQueryLabels added in v9.22.0

func (c AutoPipeliner) TSQueryLabels(ctx context.Context, filterExpr []string) *StringSliceCmd

TSQueryLabels - Returns the set of label names present on the time series matching the filter expressions. Passing no filter expressions queries all indexed series. The reply is unordered and already deduplicated by the server; it includes the label names used in the filter itself, and an empty reply is a valid result, not an error. filterExpr uses the same filter language as TSQueryIndex and is passed to the server verbatim. Available since Redis 8.10. For more information - https://redis.io/commands/ts.querylabels/

func (AutoPipeliner) TSRange added in v9.22.0

func (c AutoPipeliner) TSRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd

TSRange - Returns a range of samples from a time-series key. For more information - https://redis.io/commands/ts.range/

func (AutoPipeliner) TSRangeWithArgs added in v9.22.0

func (c AutoPipeliner) TSRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRangeOptions) *TSTimestampValueSliceCmd

TSRangeWithArgs - Returns a range of samples from a time-series key with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregator, BucketDuration, BucketTimestamp and Empty. For more information - https://redis.io/commands/ts.range/

func (AutoPipeliner) TSRead added in v9.22.0

func (c AutoPipeliner) TSRead(ctx context.Context, key string, timestamp interface{}) *TSTimestampValueSliceCmd

TSRead - Returns samples at or after timestamp, in ascending order. timestamp is a non-negative Unix-ms integer or a sentinel (TSReadEarliest, TSReadLatest, TSReadNew). For more information - https://redis.io/commands/ts.read/

func (AutoPipeliner) TSReadWithArgs added in v9.22.0

func (c AutoPipeliner) TSReadWithArgs(ctx context.Context, key string, timestamp interface{}, options *TSReadOptions) *TSTimestampValueSliceCmd

TSReadWithArgs - TS.READ with the optional BLOCK and MAX_COUNT groups. When options.Block is set it waits for options.MinCount samples or until options.Timeout elapses. Blocking calls must not be used in a pipeline or MULTI. For more information - https://redis.io/commands/ts.read/

func (AutoPipeliner) TSRevRange added in v9.22.0

func (c AutoPipeliner) TSRevRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd

TSRevRange - Returns a range of samples from a time-series key in reverse order. For more information - https://redis.io/commands/ts.revrange/

func (AutoPipeliner) TSRevRangeWithArgs added in v9.22.0

func (c AutoPipeliner) TSRevRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRevRangeOptions) *TSTimestampValueSliceCmd

TSRevRangeWithArgs - Returns a range of samples from a time-series key in reverse order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregator, BucketDuration, BucketTimestamp and Empty. For more information - https://redis.io/commands/ts.revrange/

func (AutoPipeliner) TTL added in v9.22.0

func (c AutoPipeliner) TTL(ctx context.Context, key string) *DurationCmd

func (AutoPipeliner) Time added in v9.22.0

func (c AutoPipeliner) Time(ctx context.Context) *TimeCmd

func (AutoPipeliner) TopKAdd added in v9.22.0

func (c AutoPipeliner) TopKAdd(ctx context.Context, key string, elements ...interface{}) *StringSliceCmd

TopKAdd adds one or more elements to a Top-K filter. Returns an array of strings representing the items that were removed from the filter, if any. For more information - https://redis.io/commands/topk.add/

func (AutoPipeliner) TopKCount added in v9.22.0

func (c AutoPipeliner) TopKCount(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

TopKCount returns an estimate of the number of times an item may be in a Top-K filter. For more information - https://redis.io/commands/topk.count/

func (AutoPipeliner) TopKIncrBy added in v9.22.0

func (c AutoPipeliner) TopKIncrBy(ctx context.Context, key string, elements ...interface{}) *StringSliceCmd

TopKIncrBy increases the count of one or more items in a Top-K filter. For more information - https://redis.io/commands/topk.incrby/

func (AutoPipeliner) TopKInfo added in v9.22.0

func (c AutoPipeliner) TopKInfo(ctx context.Context, key string) *TopKInfoCmd

TopKInfo returns information about a Top-K filter. For more information - https://redis.io/commands/topk.info/

func (AutoPipeliner) TopKList added in v9.22.0

func (c AutoPipeliner) TopKList(ctx context.Context, key string) *StringSliceCmd

TopKList returns all items in Top-K list. For more information - https://redis.io/commands/topk.list/

func (AutoPipeliner) TopKListWithCount added in v9.22.0

func (c AutoPipeliner) TopKListWithCount(ctx context.Context, key string) *MapStringIntCmd

TopKListWithCount returns all items in Top-K list with their respective count. For more information - https://redis.io/commands/topk.list/

func (AutoPipeliner) TopKQuery added in v9.22.0

func (c AutoPipeliner) TopKQuery(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

TopKQuery check if multiple elements exist in a Top-K filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/topk.query/

func (AutoPipeliner) TopKReserve added in v9.22.0

func (c AutoPipeliner) TopKReserve(ctx context.Context, key string, k int64) *StatusCmd

TopKReserve creates an empty Top-K filter with the specified number of top items to keep. For more information - https://redis.io/commands/topk.reserve/

func (AutoPipeliner) TopKReserveWithOptions added in v9.22.0

func (c AutoPipeliner) TopKReserveWithOptions(ctx context.Context, key string, k int64, width, depth int64, decay float64) *StatusCmd

TopKReserveWithOptions creates an empty Top-K filter with the specified number of top items to keep and additional options. This function allows for specifying additional options such as width, depth and decay. For more information - https://redis.io/commands/topk.reserve/

func (AutoPipeliner) Touch added in v9.22.0

func (c AutoPipeliner) Touch(ctx context.Context, keys ...string) *IntCmd

func (*AutoPipeliner) TxPipeline added in v9.22.0

func (ap *AutoPipeliner) TxPipeline() Pipeliner

TxPipeline returns a new transaction pipeline that uses the underlying pipeliner. This allows you to create a traditional transaction pipeline from an autopipeliner. It delegates to the underlying client's TxPipeline.

func (*AutoPipeliner) TxPipelined added in v9.22.0

func (ap *AutoPipeliner) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)

TxPipelined executes a function in a transaction pipeline context. This is a convenience method that creates a transaction pipeline, executes the function, and returns the results. It delegates to the underlying client's TxPipeline.

func (AutoPipeliner) Type added in v9.22.0

func (c AutoPipeliner) Type(ctx context.Context, key string) *StatusCmd
func (c AutoPipeliner) Unlink(ctx context.Context, keys ...string) *IntCmd

func (AutoPipeliner) VAdd added in v9.22.0

func (c AutoPipeliner) VAdd(ctx context.Context, key, element string, val Vector) *BoolCmd

`VADD key (FP32 | VALUES num) vector element` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VAddWithArgs added in v9.22.0

func (c AutoPipeliner) VAddWithArgs(ctx context.Context, key, element string, val Vector, addArgs *VAddArgs) *BoolCmd

`VADD key [REDUCE dim] (FP32 | VALUES num) vector element [CAS] [NOQUANT | Q8 | BIN] [EF build-exploration-factor] [SETATTR attributes] [M numlinks]` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VCard added in v9.22.0

func (c AutoPipeliner) VCard(ctx context.Context, key string) *IntCmd

`VCARD key` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VClearAttributes added in v9.22.0

func (c AutoPipeliner) VClearAttributes(ctx context.Context, key, element string) *BoolCmd

`VClearAttributes` clear attributes on a vector set element. The implementation of `VClearAttributes` is execute command `VSETATTR key element ""`. note: the API is experimental and may be subject to change.

func (AutoPipeliner) VDim added in v9.22.0

func (c AutoPipeliner) VDim(ctx context.Context, key string) *IntCmd

`VDIM key` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VEmb added in v9.22.0

func (c AutoPipeliner) VEmb(ctx context.Context, key, element string, raw bool) *SliceCmd

`VEMB key element [RAW]` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VGetAttr added in v9.22.0

func (c AutoPipeliner) VGetAttr(ctx context.Context, key, element string) *StringCmd

`VGETATTR key element` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VInfo added in v9.22.0

func (c AutoPipeliner) VInfo(ctx context.Context, key string) *MapStringInterfaceCmd

`VINFO key` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VIsMember added in v9.22.0

func (c AutoPipeliner) VIsMember(ctx context.Context, key, element string) *BoolCmd

`VISMEMBER key element` Check if an element exists in a vector set. note: the API is experimental and may be subject to change.

func (c AutoPipeliner) VLinks(ctx context.Context, key, element string) *StringSliceSliceCmd

`VLINKS key element` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VLinksWithScores added in v9.22.0

func (c AutoPipeliner) VLinksWithScores(ctx context.Context, key, element string) *VectorScoreSliceSliceCmd

`VLINKS key element WITHSCORES` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VRandMember added in v9.22.0

func (c AutoPipeliner) VRandMember(ctx context.Context, key string) *StringCmd

`VRANDMEMBER key` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VRandMemberCount added in v9.22.0

func (c AutoPipeliner) VRandMemberCount(ctx context.Context, key string, count int) *StringSliceCmd

`VRANDMEMBER key [count]` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VRange added in v9.22.0

func (c AutoPipeliner) VRange(ctx context.Context, key, start, end string, count int64) *StringSliceCmd

`VRANGE key start end count` a negative count means to return all the elements in the vector set. note: the API is experimental and may be subject to change.

func (AutoPipeliner) VRem added in v9.22.0

func (c AutoPipeliner) VRem(ctx context.Context, key, element string) *BoolCmd

`VREM key element` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSetAttr added in v9.22.0

func (c AutoPipeliner) VSetAttr(ctx context.Context, key, element string, attr interface{}) *BoolCmd

`VSETATTR key element "{ JSON obj }"` The `attr` must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON.

note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSim added in v9.22.0

func (c AutoPipeliner) VSim(ctx context.Context, key string, val Vector) *StringSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element)` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSimWithArgs added in v9.22.0

func (c AutoPipeliner) VSimWithArgs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *StringSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSimWithArgsWithAttribs added in v9.22.0

func (c AutoPipeliner) VSimWithArgsWithAttribs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorAttribSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHATTRIBS] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` WITHATTRIBS is only available in Redis v8.2.0+ note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSimWithArgsWithScores added in v9.22.0

func (c AutoPipeliner) VSimWithArgsWithScores(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorScoreSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSimWithArgsWithScoresWithAttribs added in v9.22.0

func (c AutoPipeliner) VSimWithArgsWithScoresWithAttribs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorScoreAttribSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [WITHATTRIBS] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` WITHATTRIBS is only available in Redis v8.2.0+ note: the API is experimental and may be subject to change.

func (AutoPipeliner) VSimWithScores added in v9.22.0

func (c AutoPipeliner) VSimWithScores(ctx context.Context, key string, val Vector) *VectorScoreSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) WITHSCORES` note: the API is experimental and may be subject to change.

func (AutoPipeliner) Wait added in v9.22.0

func (c AutoPipeliner) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd

func (AutoPipeliner) WaitAOF added in v9.22.0

func (c AutoPipeliner) WaitAOF(ctx context.Context, numLocal, numSlaves int, timeout time.Duration) *IntSliceCmd

func (*AutoPipeliner) WaitClosed added in v9.23.0

func (ap *AutoPipeliner) WaitClosed() error

WaitClosed blocks until the Close that claimed the shutdown has finished its drain, then returns that drain's result. Close itself returns immediately for any caller that loses the shutdown CAS (so a re-entrant Close from an in-flight dispatch cannot self-wait); a caller that must not act on "closed" until accepted commands have been flushed calls Close and then WaitClosed. The canonical use is a wrapping client whose own Close tears down shared connection pools: Close, WaitClosed, then close the pools — so the pools are never torn down under the winning Close's in-flight drain. Call after Close; with no Close in progress it blocks until one happens.

func (*AutoPipeliner) Watch added in v9.22.0

func (ap *AutoPipeliner) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error

Watch runs a transactional function on the underlying client (not batched).

func (AutoPipeliner) XAck added in v9.22.0

func (c AutoPipeliner) XAck(ctx context.Context, stream, group string, ids ...string) *IntCmd

func (AutoPipeliner) XAckDel added in v9.22.0

func (c AutoPipeliner) XAckDel(ctx context.Context, stream string, group string, mode string, ids ...string) *SliceCmd

func (AutoPipeliner) XAdd added in v9.22.0

func (c AutoPipeliner) XAdd(ctx context.Context, a *XAddArgs) *StringCmd

func (AutoPipeliner) XAutoClaim added in v9.22.0

func (c AutoPipeliner) XAutoClaim(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (AutoPipeliner) XAutoClaimJustID added in v9.22.0

func (c AutoPipeliner) XAutoClaimJustID(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (AutoPipeliner) XAutoClaimWithDeleted added in v9.22.0

func (c AutoPipeliner) XAutoClaimWithDeleted(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimWithDeletedCmd

func (AutoPipeliner) XCfgSet added in v9.22.0

func (c AutoPipeliner) XCfgSet(ctx context.Context, a *XCfgSetArgs) *StatusCmd

XCfgSet sets the idempotent production configuration for a stream. XCFGSET key [IDMP-DURATION duration] [IDMP-MAXSIZE maxsize]

func (AutoPipeliner) XClaim added in v9.22.0

func (c AutoPipeliner) XClaim(ctx context.Context, a *XClaimArgs) *XMessageSliceCmd

func (AutoPipeliner) XClaimJustID added in v9.22.0

func (c AutoPipeliner) XClaimJustID(ctx context.Context, a *XClaimArgs) *StringSliceCmd

func (AutoPipeliner) XDel added in v9.22.0

func (c AutoPipeliner) XDel(ctx context.Context, stream string, ids ...string) *IntCmd

func (AutoPipeliner) XDelEx added in v9.22.0

func (c AutoPipeliner) XDelEx(ctx context.Context, stream string, mode string, ids ...string) *SliceCmd

func (AutoPipeliner) XGroupCreate added in v9.22.0

func (c AutoPipeliner) XGroupCreate(ctx context.Context, stream, group, start string) *StatusCmd

func (AutoPipeliner) XGroupCreateConsumer added in v9.22.0

func (c AutoPipeliner) XGroupCreateConsumer(ctx context.Context, stream, group, consumer string) *IntCmd

func (AutoPipeliner) XGroupCreateMkStream added in v9.22.0

func (c AutoPipeliner) XGroupCreateMkStream(ctx context.Context, stream, group, start string) *StatusCmd

func (AutoPipeliner) XGroupDelConsumer added in v9.22.0

func (c AutoPipeliner) XGroupDelConsumer(ctx context.Context, stream, group, consumer string) *IntCmd

func (AutoPipeliner) XGroupDestroy added in v9.22.0

func (c AutoPipeliner) XGroupDestroy(ctx context.Context, stream, group string) *IntCmd

func (AutoPipeliner) XGroupSetID added in v9.22.0

func (c AutoPipeliner) XGroupSetID(ctx context.Context, stream, group, start string) *StatusCmd

func (AutoPipeliner) XInfoConsumers added in v9.22.0

func (c AutoPipeliner) XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd

func (AutoPipeliner) XInfoGroups added in v9.22.0

func (c AutoPipeliner) XInfoGroups(ctx context.Context, key string) *XInfoGroupsCmd

func (AutoPipeliner) XInfoStream added in v9.22.0

func (c AutoPipeliner) XInfoStream(ctx context.Context, key string) *XInfoStreamCmd

func (AutoPipeliner) XInfoStreamFull added in v9.22.0

func (c AutoPipeliner) XInfoStreamFull(ctx context.Context, key string, count int) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.

func (AutoPipeliner) XLen added in v9.22.0

func (c AutoPipeliner) XLen(ctx context.Context, stream string) *IntCmd

func (AutoPipeliner) XNack added in v9.22.0

func (c AutoPipeliner) XNack(ctx context.Context, a *XNackArgs) *IntCmd

XNack executes the XNACK command. See XNackArgs for the full argument documentation. Requires Redis >= 8.8.

func (AutoPipeliner) XPending added in v9.22.0

func (c AutoPipeliner) XPending(ctx context.Context, stream, group string) *XPendingCmd

func (AutoPipeliner) XPendingExt added in v9.22.0

func (c AutoPipeliner) XPendingExt(ctx context.Context, a *XPendingExtArgs) *XPendingExtCmd

func (AutoPipeliner) XRange added in v9.22.0

func (c AutoPipeliner) XRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd

func (AutoPipeliner) XRangeN added in v9.22.0

func (c AutoPipeliner) XRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd

func (AutoPipeliner) XRead added in v9.22.0

func (c AutoPipeliner) XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd

func (AutoPipeliner) XReadGroup added in v9.22.0

func (c AutoPipeliner) XReadGroup(ctx context.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (AutoPipeliner) XReadStreams added in v9.22.0

func (c AutoPipeliner) XReadStreams(ctx context.Context, streams ...string) *XStreamSliceCmd

func (AutoPipeliner) XRevRange added in v9.22.0

func (c AutoPipeliner) XRevRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd

func (AutoPipeliner) XRevRangeN added in v9.22.0

func (c AutoPipeliner) XRevRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd

func (AutoPipeliner) XTrimMaxLen added in v9.22.0

func (c AutoPipeliner) XTrimMaxLen(ctx context.Context, key string, maxLen int64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen

func (AutoPipeliner) XTrimMaxLenApprox added in v9.22.0

func (c AutoPipeliner) XTrimMaxLenApprox(ctx context.Context, key string, maxLen, limit int64) *IntCmd

XTrimMaxLenApprox trims the stream using the `~` rule. cmd: XTRIM key MAXLEN ~ maxLen [LIMIT limit]

limit == 0 omits the LIMIT clause, limit > 0 emits "LIMIT <limit>", and a negative limit (see XTrimLimitDisabled) emits "LIMIT 0" to disable the trimming effort cap.

func (AutoPipeliner) XTrimMaxLenApproxMode added in v9.22.0

func (c AutoPipeliner) XTrimMaxLenApproxMode(ctx context.Context, key string, maxLen, limit int64, mode string) *IntCmd

func (AutoPipeliner) XTrimMaxLenMode added in v9.22.0

func (c AutoPipeliner) XTrimMaxLenMode(ctx context.Context, key string, maxLen int64, mode string) *IntCmd

func (AutoPipeliner) XTrimMinID added in v9.22.0

func (c AutoPipeliner) XTrimMinID(ctx context.Context, key string, minID string) *IntCmd

func (AutoPipeliner) XTrimMinIDApprox added in v9.22.0

func (c AutoPipeliner) XTrimMinIDApprox(ctx context.Context, key string, minID string, limit int64) *IntCmd

XTrimMinIDApprox trims the stream using the `~` rule. cmd: XTRIM key MINID ~ minID [LIMIT limit]

limit == 0 omits the LIMIT clause, limit > 0 emits "LIMIT <limit>", and a negative limit (see XTrimLimitDisabled) emits "LIMIT 0" to disable the trimming effort cap.

func (AutoPipeliner) XTrimMinIDApproxMode added in v9.22.0

func (c AutoPipeliner) XTrimMinIDApproxMode(ctx context.Context, key string, minID string, limit int64, mode string) *IntCmd

func (AutoPipeliner) XTrimMinIDMode added in v9.22.0

func (c AutoPipeliner) XTrimMinIDMode(ctx context.Context, key string, minID string, mode string) *IntCmd

func (AutoPipeliner) ZAdd added in v9.22.0

func (c AutoPipeliner) ZAdd(ctx context.Context, key string, members ...Z) *IntCmd

ZAdd Redis `ZADD key score member [score member ...]` command.

func (AutoPipeliner) ZAddArgs added in v9.22.0

func (c AutoPipeliner) ZAddArgs(ctx context.Context, key string, args ZAddArgs) *IntCmd

func (AutoPipeliner) ZAddArgsIncr added in v9.22.0

func (c AutoPipeliner) ZAddArgsIncr(ctx context.Context, key string, args ZAddArgs) *FloatCmd

func (AutoPipeliner) ZAddGT added in v9.22.0

func (c AutoPipeliner) ZAddGT(ctx context.Context, key string, members ...Z) *IntCmd

ZAddGT Redis `ZADD key GT score member [score member ...]` command.

func (AutoPipeliner) ZAddLT added in v9.22.0

func (c AutoPipeliner) ZAddLT(ctx context.Context, key string, members ...Z) *IntCmd

ZAddLT Redis `ZADD key LT score member [score member ...]` command.

func (AutoPipeliner) ZAddNX added in v9.22.0

func (c AutoPipeliner) ZAddNX(ctx context.Context, key string, members ...Z) *IntCmd

ZAddNX Redis `ZADD key NX score member [score member ...]` command.

func (AutoPipeliner) ZAddXX added in v9.22.0

func (c AutoPipeliner) ZAddXX(ctx context.Context, key string, members ...Z) *IntCmd

ZAddXX Redis `ZADD key XX score member [score member ...]` command.

func (AutoPipeliner) ZCard added in v9.22.0

func (c AutoPipeliner) ZCard(ctx context.Context, key string) *IntCmd

func (AutoPipeliner) ZCount added in v9.22.0

func (c AutoPipeliner) ZCount(ctx context.Context, key, min, max string) *IntCmd

func (AutoPipeliner) ZDiff added in v9.22.0

func (c AutoPipeliner) ZDiff(ctx context.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (AutoPipeliner) ZDiffStore added in v9.22.0

func (c AutoPipeliner) ZDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (AutoPipeliner) ZDiffWithScores added in v9.22.0

func (c AutoPipeliner) ZDiffWithScores(ctx context.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (AutoPipeliner) ZIncrBy added in v9.22.0

func (c AutoPipeliner) ZIncrBy(ctx context.Context, key string, increment float64, member string) *FloatCmd

func (AutoPipeliner) ZInter added in v9.22.0

func (c AutoPipeliner) ZInter(ctx context.Context, store *ZStore) *StringSliceCmd

func (AutoPipeliner) ZInterCard added in v9.22.0

func (c AutoPipeliner) ZInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd

func (AutoPipeliner) ZInterStore added in v9.22.0

func (c AutoPipeliner) ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd

func (AutoPipeliner) ZInterWithScores added in v9.22.0

func (c AutoPipeliner) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd

func (AutoPipeliner) ZLexCount added in v9.22.0

func (c AutoPipeliner) ZLexCount(ctx context.Context, key, min, max string) *IntCmd

func (AutoPipeliner) ZMPop added in v9.22.0

func (c AutoPipeliner) ZMPop(ctx context.Context, order string, count int64, keys ...string) *ZSliceWithKeyCmd

ZMPop Pops one or more elements with the highest or lowest score from the first non-empty sorted set key from the list of provided key names. direction: "max" (highest score) or "min" (lowest score), count: > 0 example: client.ZMPop(ctx, "max", 5, "set1", "set2")

func (AutoPipeliner) ZMScore added in v9.22.0

func (c AutoPipeliner) ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd

func (AutoPipeliner) ZPopMax added in v9.22.0

func (c AutoPipeliner) ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd

func (AutoPipeliner) ZPopMin added in v9.22.0

func (c AutoPipeliner) ZPopMin(ctx context.Context, key string, count ...int64) *ZSliceCmd

func (AutoPipeliner) ZRandMember added in v9.22.0

func (c AutoPipeliner) ZRandMember(ctx context.Context, key string, count int) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (AutoPipeliner) ZRandMemberWithScores added in v9.22.0

func (c AutoPipeliner) ZRandMemberWithScores(ctx context.Context, key string, count int) *ZSliceCmd

ZRandMemberWithScores redis-server version >= 6.2.0.

func (AutoPipeliner) ZRange added in v9.22.0

func (c AutoPipeliner) ZRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

func (AutoPipeliner) ZRangeArgs added in v9.22.0

func (c AutoPipeliner) ZRangeArgs(ctx context.Context, z ZRangeArgs) *StringSliceCmd

func (AutoPipeliner) ZRangeArgsWithScores added in v9.22.0

func (c AutoPipeliner) ZRangeArgsWithScores(ctx context.Context, z ZRangeArgs) *ZSliceCmd

func (AutoPipeliner) ZRangeByLex deprecated added in v9.22.0

func (c AutoPipeliner) ZRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRangeByLex returns members in a sorted set within a lexicographical range.

Deprecated: Use ZRangeArgs with ByLex option instead as of Redis 6.2.0.

func (AutoPipeliner) ZRangeByScore deprecated added in v9.22.0

func (c AutoPipeliner) ZRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRangeByScore returns members in a sorted set within a range of scores.

Deprecated: Use ZRangeArgs with ByScore option instead as of Redis 6.2.0.

func (AutoPipeliner) ZRangeByScoreWithScores added in v9.22.0

func (c AutoPipeliner) ZRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd

func (AutoPipeliner) ZRangeStore added in v9.22.0

func (c AutoPipeliner) ZRangeStore(ctx context.Context, dst string, z ZRangeArgs) *IntCmd

func (AutoPipeliner) ZRangeWithScores added in v9.22.0

func (c AutoPipeliner) ZRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd

func (AutoPipeliner) ZRank added in v9.22.0

func (c AutoPipeliner) ZRank(ctx context.Context, key, member string) *IntCmd

func (AutoPipeliner) ZRankWithScore added in v9.22.0

func (c AutoPipeliner) ZRankWithScore(ctx context.Context, key, member string) *RankWithScoreCmd

ZRankWithScore according to the Redis documentation, if member does not exist in the sorted set or key does not exist, it will return a redis.Nil error.

func (AutoPipeliner) ZRem added in v9.22.0

func (c AutoPipeliner) ZRem(ctx context.Context, key string, members ...interface{}) *IntCmd

func (AutoPipeliner) ZRemRangeByLex added in v9.22.0

func (c AutoPipeliner) ZRemRangeByLex(ctx context.Context, key, min, max string) *IntCmd

func (AutoPipeliner) ZRemRangeByRank added in v9.22.0

func (c AutoPipeliner) ZRemRangeByRank(ctx context.Context, key string, start, stop int64) *IntCmd

func (AutoPipeliner) ZRemRangeByScore added in v9.22.0

func (c AutoPipeliner) ZRemRangeByScore(ctx context.Context, key, min, max string) *IntCmd

func (AutoPipeliner) ZRevRange deprecated added in v9.22.0

func (c AutoPipeliner) ZRevRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

ZRevRange returns members in a sorted set within a range of indexes in reverse order.

Deprecated: Use ZRangeArgs with Rev option instead as of Redis 6.2.0.

func (AutoPipeliner) ZRevRangeByLex deprecated added in v9.22.0

func (c AutoPipeliner) ZRevRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRevRangeByLex returns members in a sorted set within a lexicographical range in reverse order.

Deprecated: Use ZRangeArgs with Rev and ByLex options instead as of Redis 6.2.0.

func (AutoPipeliner) ZRevRangeByScore deprecated added in v9.22.0

func (c AutoPipeliner) ZRevRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRevRangeByScore returns members in a sorted set within a range of scores in reverse order.

Deprecated: Use ZRangeArgs with Rev and ByScore options instead as of Redis 6.2.0.

func (AutoPipeliner) ZRevRangeByScoreWithScores added in v9.22.0

func (c AutoPipeliner) ZRevRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd

func (AutoPipeliner) ZRevRangeWithScores added in v9.22.0

func (c AutoPipeliner) ZRevRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd

ZRevRangeWithScores according to the Redis documentation, if member does not exist in the sorted set or key does not exist, it will return a redis.Nil error.

func (AutoPipeliner) ZRevRank added in v9.22.0

func (c AutoPipeliner) ZRevRank(ctx context.Context, key, member string) *IntCmd

func (AutoPipeliner) ZRevRankWithScore added in v9.22.0

func (c AutoPipeliner) ZRevRankWithScore(ctx context.Context, key, member string) *RankWithScoreCmd

func (AutoPipeliner) ZScan added in v9.22.0

func (c AutoPipeliner) ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (AutoPipeliner) ZScore added in v9.22.0

func (c AutoPipeliner) ZScore(ctx context.Context, key, member string) *FloatCmd

func (AutoPipeliner) ZUnion added in v9.22.0

func (c AutoPipeliner) ZUnion(ctx context.Context, store ZStore) *StringSliceCmd

func (AutoPipeliner) ZUnionStore added in v9.22.0

func (c AutoPipeliner) ZUnionStore(ctx context.Context, dest string, store *ZStore) *IntCmd

func (AutoPipeliner) ZUnionWithScores added in v9.22.0

func (c AutoPipeliner) ZUnionWithScores(ctx context.Context, store ZStore) *ZSliceCmd

type BFInfo added in v9.1.0

type BFInfo struct {
	Capacity      int64
	Size          int64
	Filters       int64
	ItemsInserted int64
	ExpansionRate int64
}

type BFInfoCmd added in v9.1.0

type BFInfoCmd struct {
	// contains filtered or unexported fields
}

func NewBFInfoCmd added in v9.1.0

func NewBFInfoCmd(ctx context.Context, args ...interface{}) *BFInfoCmd

func (*BFInfoCmd) Args added in v9.1.0

func (cmd *BFInfoCmd) Args() []interface{}

func (*BFInfoCmd) Clone added in v9.18.0

func (cmd *BFInfoCmd) Clone() Cmder

func (*BFInfoCmd) Err added in v9.1.0

func (cmd *BFInfoCmd) Err() error

func (*BFInfoCmd) FullName added in v9.1.0

func (cmd *BFInfoCmd) FullName() string

func (*BFInfoCmd) GetCmdType added in v9.18.0

func (cmd *BFInfoCmd) GetCmdType() CmdType

func (*BFInfoCmd) Name added in v9.1.0

func (cmd *BFInfoCmd) Name() string

func (*BFInfoCmd) NoRetry added in v9.19.0

func (cmd *BFInfoCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*BFInfoCmd) Result added in v9.1.0

func (cmd *BFInfoCmd) Result() (BFInfo, error)

func (*BFInfoCmd) SetErr added in v9.1.0

func (cmd *BFInfoCmd) SetErr(e error)

func (*BFInfoCmd) SetFirstKeyPos added in v9.1.0

func (cmd *BFInfoCmd) SetFirstKeyPos(keyPos int8)

func (*BFInfoCmd) SetStepCount added in v9.18.0

func (cmd *BFInfoCmd) SetStepCount(stepCount int8)

func (*BFInfoCmd) SetVal added in v9.1.0

func (cmd *BFInfoCmd) SetVal(val BFInfo)

func (*BFInfoCmd) String added in v9.1.0

func (cmd *BFInfoCmd) String() string

func (*BFInfoCmd) Val added in v9.1.0

func (cmd *BFInfoCmd) Val() BFInfo

type BFInsertOptions added in v9.1.0

type BFInsertOptions struct {
	Capacity   int64
	Error      float64
	Expansion  int64
	NonScaling bool
	NoCreate   bool
}

type BFReserveOptions added in v9.1.0

type BFReserveOptions struct {
	Capacity   int64
	Error      float64
	Expansion  int64
	NonScaling bool
}

type BitCount

type BitCount struct {
	Start, End int64
	Unit       string // BYTE(default) | BIT
}

type BitMapCmdable added in v9.2.0

type BitMapCmdable interface {
	GetBit(ctx context.Context, key string, offset int64) *IntCmd
	SetBit(ctx context.Context, key string, offset int64, value int) *IntCmd
	BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd
	BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpDiff(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpDiff1(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpAndOr(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpOne(ctx context.Context, destKey string, keys ...string) *IntCmd
	BitOpNot(ctx context.Context, destKey string, key string) *IntCmd
	BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd
	BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *IntCmd
	BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd
	BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd
}

type BoolCmd

type BoolCmd struct {
	// contains filtered or unexported fields
}

func NewBoolCmd

func NewBoolCmd(ctx context.Context, args ...interface{}) *BoolCmd

func NewBoolResult

func NewBoolResult(val bool, err error) *BoolCmd

NewBoolResult returns a BoolCmd initialised with val and err for testing.

func (*BoolCmd) Args

func (cmd *BoolCmd) Args() []interface{}

func (*BoolCmd) Clone added in v9.18.0

func (cmd *BoolCmd) Clone() Cmder

func (*BoolCmd) Err

func (cmd *BoolCmd) Err() error

func (*BoolCmd) FullName

func (cmd *BoolCmd) FullName() string

func (*BoolCmd) GetCmdType added in v9.18.0

func (cmd *BoolCmd) GetCmdType() CmdType

func (*BoolCmd) Name

func (cmd *BoolCmd) Name() string

func (*BoolCmd) NoRetry added in v9.19.0

func (cmd *BoolCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*BoolCmd) Result

func (cmd *BoolCmd) Result() (bool, error)

func (*BoolCmd) SetErr

func (cmd *BoolCmd) SetErr(e error)

func (*BoolCmd) SetFirstKeyPos

func (cmd *BoolCmd) SetFirstKeyPos(keyPos int8)

func (*BoolCmd) SetStepCount added in v9.18.0

func (cmd *BoolCmd) SetStepCount(stepCount int8)

func (*BoolCmd) SetVal

func (cmd *BoolCmd) SetVal(val bool)

func (*BoolCmd) String

func (cmd *BoolCmd) String() string

func (*BoolCmd) Val

func (cmd *BoolCmd) Val() bool

type BoolSliceCmd

type BoolSliceCmd struct {
	// contains filtered or unexported fields
}

func NewBoolSliceCmd

func NewBoolSliceCmd(ctx context.Context, args ...interface{}) *BoolSliceCmd

func NewBoolSliceResult

func NewBoolSliceResult(val []bool, err error) *BoolSliceCmd

NewBoolSliceResult returns a BoolSliceCmd initialised with val and err for testing.

func (*BoolSliceCmd) Args

func (cmd *BoolSliceCmd) Args() []interface{}

func (*BoolSliceCmd) Clone added in v9.18.0

func (cmd *BoolSliceCmd) Clone() Cmder

func (*BoolSliceCmd) Err

func (cmd *BoolSliceCmd) Err() error

func (*BoolSliceCmd) FullName

func (cmd *BoolSliceCmd) FullName() string

func (*BoolSliceCmd) GetCmdType added in v9.18.0

func (cmd *BoolSliceCmd) GetCmdType() CmdType

func (*BoolSliceCmd) Name

func (cmd *BoolSliceCmd) Name() string

func (*BoolSliceCmd) NoRetry added in v9.19.0

func (cmd *BoolSliceCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*BoolSliceCmd) Result

func (cmd *BoolSliceCmd) Result() ([]bool, error)

func (*BoolSliceCmd) SetErr

func (cmd *BoolSliceCmd) SetErr(e error)

func (*BoolSliceCmd) SetFirstKeyPos

func (cmd *BoolSliceCmd) SetFirstKeyPos(keyPos int8)

func (*BoolSliceCmd) SetStepCount added in v9.18.0

func (cmd *BoolSliceCmd) SetStepCount(stepCount int8)

func (*BoolSliceCmd) SetVal

func (cmd *BoolSliceCmd) SetVal(val []bool)

func (*BoolSliceCmd) String

func (cmd *BoolSliceCmd) String() string

func (*BoolSliceCmd) Val

func (cmd *BoolSliceCmd) Val() []bool

type CFInfo added in v9.1.0

type CFInfo struct {
	Size             int64
	NumBuckets       int64
	NumFilters       int64
	NumItemsInserted int64
	NumItemsDeleted  int64
	BucketSize       int64
	ExpansionRate    int64
	MaxIteration     int64
}

type CFInfoCmd added in v9.1.0

type CFInfoCmd struct {
	// contains filtered or unexported fields
}

func NewCFInfoCmd added in v9.1.0

func NewCFInfoCmd(ctx context.Context, args ...interface{}) *CFInfoCmd

func (*CFInfoCmd) Args added in v9.1.0

func (cmd *CFInfoCmd) Args() []interface{}

func (*CFInfoCmd) Clone added in v9.18.0

func (cmd *CFInfoCmd) Clone() Cmder

func (*CFInfoCmd) Err added in v9.1.0

func (cmd *CFInfoCmd) Err() error

func (*CFInfoCmd) FullName added in v9.1.0

func (cmd *CFInfoCmd) FullName() string

func (*CFInfoCmd) GetCmdType added in v9.18.0

func (cmd *CFInfoCmd) GetCmdType() CmdType

func (*CFInfoCmd) Name added in v9.1.0

func (cmd *CFInfoCmd) Name() string

func (*CFInfoCmd) NoRetry added in v9.19.0

func (cmd *CFInfoCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*CFInfoCmd) Result added in v9.1.0

func (cmd *CFInfoCmd) Result() (CFInfo, error)

func (*CFInfoCmd) SetErr added in v9.1.0

func (cmd *CFInfoCmd) SetErr(e error)

func (*CFInfoCmd) SetFirstKeyPos added in v9.1.0

func (cmd *CFInfoCmd) SetFirstKeyPos(keyPos int8)

func (*CFInfoCmd) SetStepCount added in v9.18.0

func (cmd *CFInfoCmd) SetStepCount(stepCount int8)

func (*CFInfoCmd) SetVal added in v9.1.0

func (cmd *CFInfoCmd) SetVal(val CFInfo)

func (*CFInfoCmd) String added in v9.1.0

func (cmd *CFInfoCmd) String() string

func (*CFInfoCmd) Val added in v9.1.0

func (cmd *CFInfoCmd) Val() CFInfo

type CFInsertOptions added in v9.1.0

type CFInsertOptions struct {
	Capacity int64
	NoCreate bool
}

type CFReserveOptions added in v9.1.0

type CFReserveOptions struct {
	Capacity      int64
	BucketSize    int64
	MaxIterations int64
	Expansion     int64
}

type CMSInfo added in v9.1.0

type CMSInfo struct {
	Width int64
	Depth int64
	Count int64
	// CellSize is the size in bytes of each counter (1, 2, 4 or 8).
	// Reported since Redis 8.12, alongside the CELL_SIZE option of
	// CMS.INITBYDIM / CMS.INITBYPROB; zero on older servers.
	CellSize int64
}

type CMSInfoCmd added in v9.1.0

type CMSInfoCmd struct {
	// contains filtered or unexported fields
}

func NewCMSInfoCmd added in v9.1.0

func NewCMSInfoCmd(ctx context.Context, args ...interface{}) *CMSInfoCmd

func (*CMSInfoCmd) Args added in v9.1.0

func (cmd *CMSInfoCmd) Args() []interface{}

func (*CMSInfoCmd) Clone added in v9.18.0

func (cmd *CMSInfoCmd) Clone() Cmder

func (*CMSInfoCmd) Err added in v9.1.0

func (cmd *CMSInfoCmd) Err() error

func (*CMSInfoCmd) FullName added in v9.1.0

func (cmd *CMSInfoCmd) FullName() string

func (*CMSInfoCmd) GetCmdType added in v9.18.0

func (cmd *CMSInfoCmd) GetCmdType() CmdType

func (*CMSInfoCmd) Name added in v9.1.0

func (cmd *CMSInfoCmd) Name() string

func (*CMSInfoCmd) NoRetry added in v9.19.0

func (cmd *CMSInfoCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*CMSInfoCmd) Result added in v9.1.0

func (cmd *CMSInfoCmd) Result() (CMSInfo, error)

func (*CMSInfoCmd) SetErr added in v9.1.0

func (cmd *CMSInfoCmd) SetErr(e error)

func (*CMSInfoCmd) SetFirstKeyPos added in v9.1.0

func (cmd *CMSInfoCmd) SetFirstKeyPos(keyPos int8)

func (*CMSInfoCmd) SetStepCount added in v9.18.0

func (cmd *CMSInfoCmd) SetStepCount(stepCount int8)

func (*CMSInfoCmd) SetVal added in v9.1.0

func (cmd *CMSInfoCmd) SetVal(val CMSInfo)

func (*CMSInfoCmd) String added in v9.1.0

func (cmd *CMSInfoCmd) String() string

func (*CMSInfoCmd) Val added in v9.1.0

func (cmd *CMSInfoCmd) Val() CMSInfo

type CSCRefreshStats added in v9.23.0

type CSCRefreshStats struct {
	Enqueued  uint64
	Dropped   uint64
	Refreshed uint64

	// RefreshFailed counts refresh round trips that errored (a connection or
	// protocol failure during the batch). Those keys stay evicted and a later read
	// repopulates them, so a rising count means refresh is degrading to plain
	// eviction. Counted per errored batch, not per key.
	RefreshFailed uint64

	// DemandFlushes counts collection windows flushed early because a reader
	// missed a key still sitting in the window (vs flushed by the window timer or
	// the size cap). High relative to total flushes means the demand trigger is
	// doing its job — actively-read batches refresh in ~one RTT instead of
	// waiting out the window.
	DemandFlushes uint64

	// Invalidations counts keys named in INCOMING invalidation pushes, tallied at
	// the handler before dedup/batching. Deletions counts keys the cache actually
	// processed for removal; under duplicate pushes Deletions < Invalidations
	// because the batcher dedups (and, under an invalidation flood, the spill-cap
	// full-Flush supersedes queued deletes wholesale — those count as invalidations
	// but not deletions). So Invalidations - Deletions measures dedup + flood
	// fallback, not dedup alone. DeletionsNoop counts applied deletes that matched
	// no live entry, the direct duplicate-invalidation signature.
	Invalidations uint64
	Deletions     uint64
	DeletionsNoop uint64
}

CSCRefreshStats reports refresh-on-invalidate activity: keys queued, keys dropped because the backlog was full, and values actually republished.

Experimental: this API may change in a minor release.

type CSCStats added in v9.22.0

type CSCStats struct {
	Hits             uint64
	Misses           uint64
	Entries          int
	MemoryUsageBytes int64
}

CSCStats reports cumulative client-side cache activity and current residency.

Experimental: this API may change in a minor release.

type CSCStrategy added in v9.22.0

type CSCStrategy int

CSCStrategy selects the client-side caching invalidation architecture. Set via Options.ClientSideCacheStrategy; fixed for the client's lifetime.

CSCStrategySharedTracking is currently the only implemented strategy; the type exists as an extension point for additional architectures (e.g. a BCAST sidecar) without a breaking API change.

Experimental: this API may change in a minor release.

const (
	// CSCStrategySharedTracking (default, the zero value): one shared cache; every
	// pool connection runs plain CLIENT TRACKING ON and a background drainer applies
	// buffered invalidations. Portable (no BCAST), and matches the other Redis clients.
	CSCStrategySharedTracking CSCStrategy = iota
)

type Cache added in v9.22.0

type Cache interface {
	Get(ctx context.Context, cacheKey string) ([]byte, bool)
	Reserve(cacheKey string, redisKeys []string) (token uint64, shouldFetch bool)
	// FulfillOwned publishes a reserved value and records the connection that
	// fetched it so the entry can be evicted if that connection loses tracking.
	FulfillOwned(cacheKey string, token, ownerConnID uint64, value []byte) bool
	Cancel(cacheKey string, token uint64) bool
	DeleteByRedisKey(redisKey string) int
	DeleteByCacheKey(cacheKey string) bool
	// EvictByConn removes every entry fetched by connID.
	EvictByConn(connID uint64) int
	Flush() int
}

Cache is the thread-safe storage contract used by client-side caching.

All methods may be called concurrently. Cache keys and Redis keys are opaque strings and must be preserved exactly. Removing a reservation must wake any Get calls waiting for it.

Reserve must allow only one caller to fetch a missing key and return a token that is valid until FulfillOwned, Cancel, or an eviction removes that reservation. FulfillOwned and Cancel must modify only a reservation with the matching token. Get may wait for an in-progress reservation and must stop waiting when ctx is done.

Experimental: this API may change in a minor release.

type CacheConfig added in v9.22.0

type CacheConfig struct {
	// MaxEntries limits the number of entries. Zero or negative means unlimited.
	MaxEntries int
	// MaxMemoryBytes limits estimated memory usage in bytes. Zero or negative means unlimited.
	//
	// If both MaxEntries and MaxMemoryBytes are unlimited, MaxEntries defaults to
	// defaultCacheMaxEntries so the cache cannot grow without bound. The cache is
	// sharded 16 ways (above small thresholds) and each shard enforces its 1/16
	// share, so an entry larger than MaxMemoryBytes/16 is never admitted —
	// size it to at least 16× your largest reply.
	MaxMemoryBytes int64
	// Sizer estimates memory usage per entry. If nil, a built-in approximation is used.
	//
	// Sizer may be invoked concurrently from multiple goroutines and must be
	// thread-safe. It must return quickly and must not call back into the
	// cache (Get, Set, Delete*, Flush, etc.): some call sites hold an internal
	// shard lock, so re-entry can deadlock.
	Sizer CacheSizer
	// StaleTimeout is the duration after which an IN_PROGRESS placeholder is
	// considered stale and eligible for takeover by a new Reserve call.
	// If zero, defaults to defaultStaleTimeout (5s).
	StaleTimeout time.Duration

	// DrainInterval is the background-drainer period (default 5ms; zero uses the
	// default): how often idle pool conns are swept for buffered "invalidate"
	// frames, roughly bounding cache-hit staleness. Values below 1ms are clamped
	// to 1ms.
	DrainInterval time.Duration

	// MaxStaleness caps how long a cached entry is served after it became valid,
	// regardless of invalidation. It is a correctness
	// BACKSTOP for lost invalidations or connection-lifecycle gaps ("Window 2"), not
	// the primary freshness mechanism. Keep it well above the invalidation round-trip
	// (e.g. seconds); per-entry refetch overhead scales ~1/MaxStaleness.
	//
	// Default: 0 (disabled).
	MaxStaleness time.Duration
}

CacheConfig configures a local cache instance.

Experimental: this API may change in a minor release.

type CacheSizer added in v9.22.0

type CacheSizer func(cacheKey string, redisKeys []string, value []byte) int64

CacheSizer calculates estimated memory usage in bytes for a cache entry.

Experimental: this API may change in a minor release.

type ChannelOption

type ChannelOption func(c *channel)

func WithChannelHealthCheckInterval

func WithChannelHealthCheckInterval(d time.Duration) ChannelOption

WithChannelHealthCheckInterval specifies the health check interval. PubSub will ping Redis Server if it does not receive any messages within the interval. To disable health check, use zero interval.

The default is 3 seconds.

func WithChannelPingTimeout added in v9.21.0

func WithChannelPingTimeout(d time.Duration) ChannelOption

WithChannelPingTimeout specifies the timeout for the health-check ping.

The default is 5 seconds.

func WithChannelReconnectTimeout added in v9.21.0

func WithChannelReconnectTimeout(d time.Duration) ChannelOption

WithChannelReconnectTimeout specifies the timeout for reconnecting after a failed health-check ping.

The default is 10 seconds.

func WithChannelSendTimeout

func WithChannelSendTimeout(d time.Duration) ChannelOption

WithChannelSendTimeout specifies the channel send timeout after which the message is dropped.

The default is 60 seconds.

func WithChannelSize

func WithChannelSize(size int) ChannelOption

WithChannelSize specifies the Go chan size that is used to buffer incoming messages.

The default is 100 messages.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Redis client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.

Client creates and frees connections automatically; it also maintains a free pool of idle connections. You can control the pool size with Config.PoolSize option.

Example
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	err := rdb.Set(ctx, "key", "value", 0).Err()
	if err != nil {
		panic(err)
	}

	val, err := rdb.Get(ctx, "key").Result()
	if err != nil {
		panic(err)
	}
	fmt.Println("key", val)

	val2, err := rdb.Get(ctx, "missing_key").Result()
	if err == redis.Nil {
		fmt.Println("missing_key does not exist")
	} else if err != nil {
		panic(err)
	} else {
		fmt.Println("missing_key", val2)
	}
}
Output:
key value
missing_key does not exist

func NewClient

func NewClient(opt *Options) *Client

NewClient returns a client to the Redis Server specified by Options. Passing nil Options will cause a panic.

Example
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func main() {
	rdb := redis.NewClient(&redis.Options{
		Addr:     "localhost:6379", // use default Addr
		Password: "",               // no password set
		DB:       0,                // use default DB
	})

	pong, err := rdb.Ping(ctx).Result()
	fmt.Println(pong, err)
}
Output:
PONG <nil>

func NewFailoverClient

func NewFailoverClient(failoverOpt *FailoverOptions) *Client

NewFailoverClient returns a Redis client that uses Redis Sentinel for automatic failover. It's safe for concurrent use by multiple goroutines. Passing nil FailoverOptions will cause a panic.

Example
package main

import (
	"context"

	"github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func main() {
	// See https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel for instructions how to
	// setup Redis Sentinel.
	rdb := redis.NewFailoverClient(&redis.FailoverOptions{
		MasterName:    "master",
		SentinelAddrs: []string{":26379"},
	})
	rdb.Ping(ctx)
}

func (Client) ACLCat added in v9.7.2

func (c Client) ACLCat(ctx context.Context) *StringSliceCmd

func (Client) ACLCatArgs added in v9.7.2

func (c Client) ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd

func (Client) ACLDelUser added in v9.7.2

func (c Client) ACLDelUser(ctx context.Context, username string) *IntCmd

func (Client) ACLDryRun added in v9.0.3

func (c Client) ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd

func (Client) ACLGenPass added in v9.17.0

func (c Client) ACLGenPass(ctx context.Context, bit int) *StringCmd

func (Client) ACLList added in v9.7.2

func (c Client) ACLList(ctx context.Context) *StringSliceCmd

func (Client) ACLLog added in v9.0.5

func (c Client) ACLLog(ctx context.Context, count int64) *ACLLogCmd

func (Client) ACLLogReset added in v9.0.5

func (c Client) ACLLogReset(ctx context.Context) *StatusCmd

func (Client) ACLSetUser added in v9.7.2

func (c Client) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd

func (Client) ACLUsers added in v9.17.0

func (c Client) ACLUsers(ctx context.Context) *StringSliceCmd

func (Client) ACLWhoAmI added in v9.17.0

func (c Client) ACLWhoAmI(ctx context.Context) *StringCmd

func (Client) ARCount added in v9.20.0

func (c Client) ARCount(ctx context.Context, key string) *UintCmd

ARCount returns the number of non-empty elements in an array. Returns 0 if the key does not exist.

func (Client) ARDel added in v9.20.0

func (c Client) ARDel(ctx context.Context, key string, indexes ...uint64) *IntCmd

ARDel deletes elements at the specified indexes in an array. Returns the number of elements deleted.

func (Client) ARDelRange added in v9.20.0

func (c Client) ARDelRange(ctx context.Context, key string, ranges ...ARRange) *UintCmd

ARDelRange deletes elements in one or more ranges. Returns the number of elements deleted.

func (Client) ARGet added in v9.20.0

func (c Client) ARGet(ctx context.Context, key string, index uint64) *StringCmd

ARGet gets the value at an index in an array. Returns redis.Nil if the key or index does not exist.

func (Client) ARGetRange added in v9.20.0

func (c Client) ARGetRange(ctx context.Context, key string, start, end uint64) *SliceCmd

ARGetRange gets values in a range of indexes. Returns values in the range, with nil for unset indexes.

func (Client) ARGrep added in v9.20.0

func (c Client) ARGrep(ctx context.Context, key string, start, end string, grepArgs *ARGrepArgs) *UintSliceCmd

ARGrep searches array elements in a range using textual predicates. Returns matching indexes only. Use ARGrepWithValues to also get the values.

func (Client) ARGrepWithValues added in v9.20.0

func (c Client) ARGrepWithValues(ctx context.Context, key string, start, end string, grepArgs *ARGrepArgs) *AREntrySliceCmd

ARGrepWithValues searches array elements in a range using textual predicates. Returns matching indexes and their values as index-value pairs.

func (Client) ARInfo added in v9.20.0

func (c Client) ARInfo(ctx context.Context, key string) *MapStringInterfaceCmd

ARInfo returns metadata about an array.

func (Client) ARInfoFull added in v9.20.0

func (c Client) ARInfoFull(ctx context.Context, key string) *MapStringInterfaceCmd

ARInfoFull returns detailed metadata about an array including slice statistics.

func (Client) ARInsert added in v9.20.0

func (c Client) ARInsert(ctx context.Context, key string, values ...string) *UintCmd

ARInsert inserts one or more values at consecutive indexes. Returns the last index where a value was inserted.

func (Client) ARLastItems added in v9.20.0

func (c Client) ARLastItems(ctx context.Context, key string, count uint64, rev bool) *SliceCmd

ARLastItems returns the most recently inserted elements. When rev is true, returns items in reverse order.

func (Client) ARLen added in v9.20.0

func (c Client) ARLen(ctx context.Context, key string) *UintCmd

ARLen returns the length of an array (max index + 1). Returns 0 if the key does not exist.

func (Client) ARMGet added in v9.20.0

func (c Client) ARMGet(ctx context.Context, key string, indexes ...uint64) *SliceCmd

ARMGet gets values at multiple indexes in an array. Returns values at the specified indexes, with nil for unset indexes.

func (Client) ARMSet added in v9.20.0

func (c Client) ARMSet(ctx context.Context, key string, members ...AREntry) *IntCmd

ARMSet sets multiple index-value pairs in an array. Returns the number of new slots that were set (previously empty).

func (Client) ARNext added in v9.20.0

func (c Client) ARNext(ctx context.Context, key string) *UintCmd

ARNext returns the next index ARINSERT would use. Returns 0 for missing keys or when no insert happened yet. Returns nil when the insertion cursor is exhausted / would overflow.

func (Client) AROpAnd added in v9.20.0

func (c Client) AROpAnd(ctx context.Context, key string, start, end uint64) *IntCmd

AROpAnd returns the bitwise AND of integer elements in a range.

func (Client) AROpMatch added in v9.20.0

func (c Client) AROpMatch(ctx context.Context, key string, start, end uint64, value string) *IntCmd

AROpMatch returns the count of elements matching a target string in a range.

func (Client) AROpMax added in v9.20.0

func (c Client) AROpMax(ctx context.Context, key string, start, end uint64) *StringCmd

AROpMax returns the maximum numeric element in a range.

func (Client) AROpMin added in v9.20.0

func (c Client) AROpMin(ctx context.Context, key string, start, end uint64) *StringCmd

AROpMin returns the minimum numeric element in a range.

func (Client) AROpOr added in v9.20.0

func (c Client) AROpOr(ctx context.Context, key string, start, end uint64) *IntCmd

AROpOr returns the bitwise OR of integer elements in a range.

func (Client) AROpSum added in v9.20.0

func (c Client) AROpSum(ctx context.Context, key string, start, end uint64) *StringCmd

AROpSum returns the sum of numeric elements in a range.

func (Client) AROpUsed added in v9.20.0

func (c Client) AROpUsed(ctx context.Context, key string, start, end uint64) *IntCmd

AROpUsed returns the count of non-empty slots in a range.

func (Client) AROpXor added in v9.20.0

func (c Client) AROpXor(ctx context.Context, key string, start, end uint64) *IntCmd

AROpXor returns the bitwise XOR of integer elements in a range.

func (Client) ARRing added in v9.20.0

func (c Client) ARRing(ctx context.Context, key string, size uint64, values ...string) *UintCmd

ARRing inserts values into a ring buffer of specified size, wrapping and truncating as needed. Returns the last index where a value was inserted.

func (Client) ARScan added in v9.20.0

func (c Client) ARScan(ctx context.Context, key string, start, end uint64, scanArgs *ARScanArgs) *AREntrySliceCmd

ARScan iterates existing elements in a range, returning index-value pairs.

func (Client) ARSeek added in v9.20.0

func (c Client) ARSeek(ctx context.Context, key string, index uint64) *IntCmd

ARSeek sets the ARINSERT / ARRING cursor to a specific index. Returns 1 if the cursor was set, 0 if the key does not exist.

func (Client) ARSet added in v9.20.0

func (c Client) ARSet(ctx context.Context, key string, index uint64, values ...string) *IntCmd

ARSet sets one or more contiguous values starting at an index in an array. Returns the number of new slots that were set (previously empty).

func (Client) Append

func (c Client) Append(ctx context.Context, key, value string) *IntCmd

func (*Client) AsyncAutoPipeline added in v9.22.0

func (c *Client) AsyncAutoPipeline() (*AutoPipeliner, error)

AsyncAutoPipeline returns the deferred (async) autopipeliner: command calls return immediately and the result accessors (Val/Result/Err) block until the command has executed. Submit a window of commands, then read their results, to keep each pipeline deep and reach the highest throughput (measured locally over loopback: ~2-3M SET/sec; indicative).

By default, Options.AutoPipelineOptions is used if set, otherwise DefaultAutoPipelineOptions (ordered, MaxConcurrentBatches: 1) — a single goroutine's deferred commands execute in submit order. Use AsyncAutoPipelineWithOptions to override (and, for parallel batches, set Unordered). The instance is cached and shared; the first call's config wins. Close it (or the client) to release its goroutines.

It returns an error if the supplied config is invalid (e.g. MaxConcurrentBatches>1 without Unordered, or a negative size); on error no instance is cached.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) AsyncAutoPipelineWithOptions added in v9.22.0

func (c *Client) AsyncAutoPipelineWithOptions(config *AutoPipelineOptions) (*AutoPipeliner, error)

AsyncAutoPipelineWithOptions is AsyncAutoPipeline with an explicit config instead of Options.AutoPipelineOptions / the default. The instance is cached and shared; the first call's config wins.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) AutoPipeline added in v9.22.0

func (c *Client) AutoPipeline() (*AutoPipeliner, error)

AutoPipeline returns the blocking autopipeliner for this client: a drop-in replacement for the normal command surface where each command call (ap.Set, ap.Get, ...) blocks until executed, exactly like a plain client — but the engine batches concurrent callers' commands into pipelines, so throughput is far higher (measured locally over loopback: ~1M+ SET/sec vs ~100k; indicative, not a guarantee). Commands keep per-goroutine order.

By default, Options.AutoPipelineOptions is used if set, otherwise DefaultBlockingAutoPipelineOptions (a single ordered batch stream, which maximizes throughput and minimizes latency for the blocking face — see its doc). The instance is cached and shared; the first call's config wins and later calls return the same instance until it is closed. It must be closed (or close the client) to release its goroutines.

It returns an error if the supplied config is invalid (e.g. MaxConcurrentBatches>1 without Unordered, or a negative size); on error no instance is cached.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) AutoPipelineWithOptions added in v9.22.0

func (c *Client) AutoPipelineWithOptions(config *AutoPipelineOptions) (*AutoPipeliner, error)

AutoPipelineWithOptions is AutoPipeline with explicit options instead of Options.AutoPipelineOptions / the default. The instance is cached and shared; the first call's config wins.

EXPERIMENTAL: this API is subject to change, use with caution.

func (Client) BFAdd added in v9.1.0

func (c Client) BFAdd(ctx context.Context, key string, element interface{}) *BoolCmd

BFAdd adds an item to a Bloom filter. For more information - https://redis.io/commands/bf.add/

func (Client) BFCard added in v9.1.0

func (c Client) BFCard(ctx context.Context, key string) *IntCmd

BFCard returns the cardinality of a Bloom filter - number of items that were added to a Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter). For more information - https://redis.io/commands/bf.card/

func (Client) BFExists added in v9.1.0

func (c Client) BFExists(ctx context.Context, key string, element interface{}) *BoolCmd

BFExists determines whether a given item was added to a Bloom filter. For more information - https://redis.io/commands/bf.exists/

func (Client) BFInfo added in v9.1.0

func (c Client) BFInfo(ctx context.Context, key string) *BFInfoCmd

Returns information about a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInfoArg added in v9.1.0

func (c Client) BFInfoArg(ctx context.Context, key, option string) *BFInfoCmd

BFInfoArg returns information about a specific option of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInfoCapacity added in v9.1.0

func (c Client) BFInfoCapacity(ctx context.Context, key string) *BFInfoCmd

BFInfoCapacity returns information about the capacity of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInfoExpansion added in v9.1.0

func (c Client) BFInfoExpansion(ctx context.Context, key string) *BFInfoCmd

BFInfoExpansion returns information about the expansion rate of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInfoFilters added in v9.1.0

func (c Client) BFInfoFilters(ctx context.Context, key string) *BFInfoCmd

BFInfoFilters returns information about the filters of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInfoItems added in v9.1.0

func (c Client) BFInfoItems(ctx context.Context, key string) *BFInfoCmd

BFInfoItems returns information about the items of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInfoSize added in v9.1.0

func (c Client) BFInfoSize(ctx context.Context, key string) *BFInfoCmd

BFInfoSize returns information about the size of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (Client) BFInsert added in v9.1.0

func (c Client) BFInsert(ctx context.Context, key string, options *BFInsertOptions, elements ...interface{}) *BoolSliceCmd

BFInsert inserts elements into a Bloom filter. This function also allows for specifying additional options such as: capacity, error rate, expansion rate, and non-scaling behavior. For more information - https://redis.io/commands/bf.insert/

func (Client) BFLoadChunk added in v9.1.0

func (c Client) BFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd

BFLoadChunk restores a Bloom filter previously saved using BF.SCANDUMP. For more information - https://redis.io/commands/bf.loadchunk/

func (Client) BFMAdd added in v9.1.0

func (c Client) BFMAdd(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

BFMAdd adds multiple elements to a Bloom filter. Returns an array of booleans indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/bf.madd/

func (Client) BFMExists added in v9.1.0

func (c Client) BFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

BFMExists check if multiple elements exist in a Bloom filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/bf.mexists/

func (Client) BFReserve added in v9.1.0

func (c Client) BFReserve(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd

BFReserve creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. For more information - https://redis.io/commands/bf.reserve/

func (Client) BFReserveExpansion added in v9.1.0

func (c Client) BFReserveExpansion(ctx context.Context, key string, errorRate float64, capacity, expansion int64) *StatusCmd

BFReserveExpansion creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying an expansion rate for the filter. For more information - https://redis.io/commands/bf.reserve/

func (Client) BFReserveNonScaling added in v9.1.0

func (c Client) BFReserveNonScaling(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd

BFReserveNonScaling creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying that the filter should not scale. For more information - https://redis.io/commands/bf.reserve/

func (Client) BFReserveWithArgs added in v9.2.0

func (c Client) BFReserveWithArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd

BFReserveWithArgs creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying additional options such as expansion rate and non-scaling behavior. For more information - https://redis.io/commands/bf.reserve/

func (Client) BFScanDump added in v9.1.0

func (c Client) BFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd

Begins an incremental save of the Bloom filter. This command is useful for large Bloom filters that cannot fit into the DUMP and RESTORE model. For more information - https://redis.io/commands/bf.scandump/

func (Client) BLMPop added in v9.0.3

func (c Client) BLMPop(ctx context.Context, timeout time.Duration, direction string, count int64, keys ...string) *KeyValuesCmd

func (Client) BLMove

func (c Client) BLMove(
	ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration,
) *StringCmd

func (Client) BLMoveM added in v9.22.0

func (c Client) BLMoveM(ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration, a LMoveMArgs) *StringSliceCmd

BLMoveM is the blocking variant of LMoveM (Redis 8.10+); timeout 0 blocks forever. Returns moved elements, or redis.Nil on timeout.

func (Client) BLPop

func (c Client) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd
Example
package main

import (
	"context"
	"fmt"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	if err := rdb.RPush(ctx, "queue", "message").Err(); err != nil {
		panic(err)
	}

	// use `rdb.BLPop(ctx, 0, "queue")` for infinite waiting time
	result, err := rdb.BLPop(ctx, 1*time.Second, "queue").Result()
	if err != nil {
		panic(err)
	}

	fmt.Println(result[0], result[1])
}
Output:
queue message

func (Client) BRPop

func (c Client) BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd

func (Client) BRPopLPush deprecated

func (c Client) BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *StringCmd

BRPopLPush pops an element from a list, pushes it to another list and returns it. Blocks until an element is available or timeout is reached.

Deprecated: Use BLMove with RIGHT and LEFT arguments instead as of Redis 6.2.0.

func (Client) BZMPop added in v9.0.3

func (c Client) BZMPop(ctx context.Context, timeout time.Duration, order string, count int64, keys ...string) *ZSliceWithKeyCmd

BZMPop is the blocking variant of ZMPOP. When any of the sorted sets contains elements, this command behaves exactly like ZMPOP. When all sorted sets are empty, Redis will block the connection until another client adds members to one of the keys or until the timeout elapses. A timeout of zero can be used to block indefinitely. example: client.BZMPop(ctx, 0,"max", 1, "set")

func (Client) BZPopMax

func (c Client) BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd

BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.

func (Client) BZPopMin

func (c Client) BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd

BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.

func (Client) BgRewriteAOF

func (c Client) BgRewriteAOF(ctx context.Context) *StatusCmd

func (Client) BgSave

func (c Client) BgSave(ctx context.Context) *StatusCmd

func (Client) BitCount

func (c Client) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd

func (Client) BitField

func (c Client) BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd

BitField accepts multiple values:

  • BitField("set", "i1", "offset1", "value1","cmd2", "type2", "offset2", "value2")
  • BitField([]string{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
  • BitField([]interface{}{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})

func (Client) BitFieldRO added in v9.3.1

func (c Client) BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd

BitFieldRO - Read-only variant of the BITFIELD command. It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas. - BitFieldRO(ctx, key, "<Encoding0>", "<Offset0>", "<Encoding1>","<Offset1>")

func (Client) BitOpAnd

func (c Client) BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpAnd creates a new bitmap in which users are members of all given bitmaps

func (Client) BitOpAndOr added in v9.12.0

func (c Client) BitOpAndOr(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpAndOr creates a new bitmap in which users are members of bitmap X and also members of one or more of bitmaps Y1, Y2, … Introduced with Redis 8.2

func (Client) BitOpDiff added in v9.12.0

func (c Client) BitOpDiff(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpDiff creates a new bitmap in which users are members of bitmap X but not of any of bitmaps Y1, Y2, … Introduced with Redis 8.2

func (Client) BitOpDiff1 added in v9.12.0

func (c Client) BitOpDiff1(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpDiff1 creates a new bitmap in which users are members of one or more of bitmaps Y1, Y2, … but not members of bitmap X Introduced with Redis 8.2

func (Client) BitOpNot

func (c Client) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd

BitOpNot creates a new bitmap in which users are not members of a given bitmap

func (Client) BitOpOne added in v9.12.0

func (c Client) BitOpOne(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpOne creates a new bitmap in which users are members of exactly one of the given bitmaps Introduced with Redis 8.2

func (Client) BitOpOr

func (c Client) BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpOr creates a new bitmap in which users are member of at least one given bitmap

func (Client) BitOpXor

func (c Client) BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpXor creates a new bitmap in which users are the result of XORing all given bitmaps

func (Client) BitPos

func (c Client) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd

BitPos is an API before Redis version 7.0, cmd: bitpos key bit start end if you need the `byte | bit` parameter, please use `BitPosSpan`.

func (Client) BitPosSpan added in v9.0.3

func (c Client) BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *IntCmd

BitPosSpan supports the `byte | bit` parameters in redis version 7.0, the bitpos command defaults to using byte type for the `start-end` range, which means it counts in bytes from start to end. you can set the value of "span" to determine the type of `start-end`. span = "bit", cmd: bitpos key bit start end bit span = "byte", cmd: bitpos key bit start end byte

func (Client) CFAdd added in v9.1.0

func (c Client) CFAdd(ctx context.Context, key string, element interface{}) *BoolCmd

CFAdd adds an element to a Cuckoo filter. Returns true if the element was added to the filter or false if it already exists in the filter. For more information - https://redis.io/commands/cf.add/

func (Client) CFAddNX added in v9.1.0

func (c Client) CFAddNX(ctx context.Context, key string, element interface{}) *BoolCmd

CFAddNX adds an element to a Cuckoo filter only if it does not already exist in the filter. Returns true if the element was added to the filter or false if it already exists in the filter. For more information - https://redis.io/commands/cf.addnx/

func (Client) CFCount added in v9.1.0

func (c Client) CFCount(ctx context.Context, key string, element interface{}) *IntCmd

CFCount returns an estimate of the number of times an element may be in a Cuckoo Filter. For more information - https://redis.io/commands/cf.count/

func (Client) CFDel added in v9.1.0

func (c Client) CFDel(ctx context.Context, key string, element interface{}) *BoolCmd

CFDel deletes an item once from the cuckoo filter. For more information - https://redis.io/commands/cf.del/

func (Client) CFExists added in v9.1.0

func (c Client) CFExists(ctx context.Context, key string, element interface{}) *BoolCmd

CFExists determines whether an item may exist in the Cuckoo Filter or not. For more information - https://redis.io/commands/cf.exists/

func (Client) CFInfo added in v9.1.0

func (c Client) CFInfo(ctx context.Context, key string) *CFInfoCmd

CFInfo returns information about a Cuckoo filter. For more information - https://redis.io/commands/cf.info/

func (Client) CFInsert added in v9.1.0

func (c Client) CFInsert(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *BoolSliceCmd

CFInsert inserts elements into a Cuckoo filter. This function also allows for specifying additional options such as capacity, error rate, expansion rate, and non-scaling behavior. Returns an array of booleans indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/cf.insert/

func (Client) CFInsertNX added in v9.1.0

func (c Client) CFInsertNX(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *IntSliceCmd

CFInsertNX inserts elements into a Cuckoo filter only if they do not already exist in the filter. This function also allows for specifying additional options such as: capacity, error rate, expansion rate, and non-scaling behavior. Returns an array of integers indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/cf.insertnx/

func (Client) CFLoadChunk added in v9.1.0

func (c Client) CFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd

CFLoadChunk restores a filter previously saved using SCANDUMP. For more information - https://redis.io/commands/cf.loadchunk/

func (Client) CFMExists added in v9.1.0

func (c Client) CFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

CFMExists check if multiple elements exist in a Cuckoo filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/cf.mexists/

func (Client) CFReserve added in v9.1.0

func (c Client) CFReserve(ctx context.Context, key string, capacity int64) *StatusCmd

CFReserve creates an empty Cuckoo filter with the specified capacity. For more information - https://redis.io/commands/cf.reserve/

func (Client) CFReserveBucketSize added in v9.1.0

func (c Client) CFReserveBucketSize(ctx context.Context, key string, capacity int64, bucketsize int64) *StatusCmd

CFReserveBucketSize creates an empty Cuckoo filter with the specified capacity and bucket size. For more information - https://redis.io/commands/cf.reserve/

func (Client) CFReserveExpansion added in v9.1.0

func (c Client) CFReserveExpansion(ctx context.Context, key string, capacity int64, expansion int64) *StatusCmd

CFReserveExpansion creates an empty Cuckoo filter with the specified capacity and expansion rate. For more information - https://redis.io/commands/cf.reserve/

func (Client) CFReserveMaxIterations added in v9.1.0

func (c Client) CFReserveMaxIterations(ctx context.Context, key string, capacity int64, maxiterations int64) *StatusCmd

CFReserveMaxIterations creates an empty Cuckoo filter with the specified capacity and maximum number of iterations. For more information - https://redis.io/commands/cf.reserve/

func (Client) CFReserveWithArgs added in v9.2.0

func (c Client) CFReserveWithArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd

CFReserveWithArgs creates an empty Cuckoo filter with the specified options. This function allows for specifying additional options such as bucket size and maximum number of iterations. For more information - https://redis.io/commands/cf.reserve/

func (Client) CFScanDump added in v9.1.0

func (c Client) CFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd

CFScanDump begins an incremental save of the cuckoo filter. For more information - https://redis.io/commands/cf.scandump/

func (Client) CMSIncrBy added in v9.1.0

func (c Client) CMSIncrBy(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

CMSIncrBy increments the count of one or more items in a Count-Min Sketch filter. Returns an array of integers representing the updated count of each item. For more information - https://redis.io/commands/cms.incrby/

func (Client) CMSInfo added in v9.1.0

func (c Client) CMSInfo(ctx context.Context, key string) *CMSInfoCmd

CMSInfo returns information about a Count-Min Sketch filter. For more information - https://redis.io/commands/cms.info/

func (Client) CMSInitByDim added in v9.1.0

func (c Client) CMSInitByDim(ctx context.Context, key string, width, depth int64) *StatusCmd

CMSInitByDim creates an empty Count-Min Sketch filter with the specified dimensions. For more information - https://redis.io/commands/cms.initbydim/

func (Client) CMSInitByProb added in v9.1.0

func (c Client) CMSInitByProb(ctx context.Context, key string, errorRate, probability float64) *StatusCmd

CMSInitByProb creates an empty Count-Min Sketch filter with the specified error rate and probability. For more information - https://redis.io/commands/cms.initbyprob/

func (Client) CMSMerge added in v9.1.0

func (c Client) CMSMerge(ctx context.Context, destKey string, sourceKeys ...string) *StatusCmd

CMSMerge merges multiple Count-Min Sketch filters into a single filter. The destination filter must not exist and will be created with the dimensions of the first source filter. The number of items in each source filter must be equal. Returns OK on success or an error if the filters could not be merged. For more information - https://redis.io/commands/cms.merge/

func (Client) CMSMergeWithWeight added in v9.1.0

func (c Client) CMSMergeWithWeight(ctx context.Context, destKey string, sourceKeys map[string]int64) *StatusCmd

CMSMergeWithWeight merges multiple Count-Min Sketch filters into a single filter with weights for each source filter. The destination filter must not exist and will be created with the dimensions of the first source filter. The number of items in each source filter must be equal. Returns OK on success or an error if the filters could not be merged. For more information - https://redis.io/commands/cms.merge/

func (Client) CMSQuery added in v9.1.0

func (c Client) CMSQuery(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

CMSQuery returns count for item(s). For more information - https://redis.io/commands/cms.query/

func (*Client) CSCRefreshStats added in v9.23.0

func (c *Client) CSCRefreshStats() CSCRefreshStats

CSCRefreshStats returns the client's refresh-on-invalidate counters.

SCOPE on a SHARED cache: Invalidations/Deletions/DeletionsNoop are cache-global (read from the shared LocalCache, so every client attached to it reports the same totals), while Enqueued/Dropped/Refreshed/RefreshFailed/DemandFlushes come from THIS client's refresh queue. With a shared cache+processor the active refresh binding is the last-attached client's queue, so an earlier client can report every invalidation but ~zero refresh work — not a defect, that client genuinely is not the one refreshing. Treat a refresh/invalidation RATIO as meaningful only for a single-client cache or for the client holding the active binding; across a shared cache the two groups are different scopes.

Experimental: this API may change in a minor release.

func (*Client) CSCStats added in v9.22.0

func (c *Client) CSCStats() CSCStats

CSCStats returns statistics for this client's client-side cache, read from the shared cache when its implementation exposes them (the built-in LocalCache does).

It returns a zero value when CSC is not configured or stats are unavailable.

Experimental: this API may change in a minor release.

func (Client) ClientGetName

func (c Client) ClientGetName(ctx context.Context) *StringCmd

ClientGetName returns the name of the connection.

func (Client) ClientID

func (c Client) ClientID(ctx context.Context) *IntCmd

func (Client) ClientInfo added in v9.0.4

func (c Client) ClientInfo(ctx context.Context) *ClientInfoCmd

func (Client) ClientKill

func (c Client) ClientKill(ctx context.Context, ipPort string) *StatusCmd

func (Client) ClientKillByFilter

func (c Client) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (Client) ClientList

func (c Client) ClientList(ctx context.Context) *StringCmd

func (Client) ClientMaintNotifications added in v9.15.0

func (c Client) ClientMaintNotifications(ctx context.Context, enabled bool, endpointType string) *StatusCmd

ClientMaintNotifications enables or disables maintenance notifications for maintenance upgrades. When enabled, the client will receive push notifications about Redis maintenance events.

func (Client) ClientPause

func (c Client) ClientPause(ctx context.Context, dur time.Duration) *BoolCmd

func (Client) ClientTracking added in v9.22.0

func (c Client) ClientTracking(ctx context.Context, on bool, opt *ClientTrackingOptions) *StatusCmd

ClientTracking enables or disables server-assisted client-side caching for the ONE connection that happens to serve this command. On a pooled client that connection is arbitrary, so this is only meaningful on a dedicated connection (see Client.Conn). When on is false, opt is ignored. Invalid option combinations are reported via the returned command's Err and nothing is sent to the server.

Must not be combined with the built-in client-side cache: on a client configured with Options.ClientSideCache or ClientSideCacheConfig this command is rejected, because changing a pool connection's tracking state would silently break the cache's invalidation.

func (Client) ClientTrackingOff added in v9.22.0

func (c Client) ClientTrackingOff(ctx context.Context) *StatusCmd

ClientTrackingOff disables tracking on the serving connection. See ClientTracking for the pooled-client and built-in-CSC caveats.

func (Client) ClientTrackingOn added in v9.22.0

func (c Client) ClientTrackingOn(ctx context.Context, opt *ClientTrackingOptions) *StatusCmd

ClientTrackingOn enables tracking on the serving connection. See ClientTracking for the pooled-client and built-in-CSC caveats.

func (Client) ClientUnblock

func (c Client) ClientUnblock(ctx context.Context, id int64) *IntCmd

func (Client) ClientUnblockWithError

func (c Client) ClientUnblockWithError(ctx context.Context, id int64) *IntCmd

func (Client) ClientUnpause

func (c Client) ClientUnpause(ctx context.Context) *BoolCmd

func (*Client) Close

func (c *Client) Close() error

Close closes the client, stopping both cached autopipeliners (the blocking AutoPipeline instance and the async AsyncAutoPipeline instance, if created) before releasing the underlying resources, so their background flusher goroutines don't outlive the client. AutoPipeliner.Close is idempotent and safe to call here even if autopipelining was never used. A WithTimeout clone delegates CSC teardown to the canonical wrapper that owns the background drainer.

func (Client) ClusterAddSlots

func (c Client) ClusterAddSlots(ctx context.Context, slots ...int) *StatusCmd

func (Client) ClusterAddSlotsRange

func (c Client) ClusterAddSlotsRange(ctx context.Context, min, max int) *StatusCmd

func (Client) ClusterCountFailureReports

func (c Client) ClusterCountFailureReports(ctx context.Context, nodeID string) *IntCmd

func (Client) ClusterCountKeysInSlot

func (c Client) ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd

func (Client) ClusterDelSlots

func (c Client) ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd

func (Client) ClusterDelSlotsRange

func (c Client) ClusterDelSlotsRange(ctx context.Context, min, max int) *StatusCmd

func (Client) ClusterFailover

func (c Client) ClusterFailover(ctx context.Context) *StatusCmd

func (Client) ClusterForget

func (c Client) ClusterForget(ctx context.Context, nodeID string) *StatusCmd

func (Client) ClusterGetKeysInSlot

func (c Client) ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *StringSliceCmd

func (Client) ClusterInfo

func (c Client) ClusterInfo(ctx context.Context) *StringCmd

func (Client) ClusterKeySlot

func (c Client) ClusterKeySlot(ctx context.Context, key string) *IntCmd
func (c Client) ClusterLinks(ctx context.Context) *ClusterLinksCmd

func (Client) ClusterMeet

func (c Client) ClusterMeet(ctx context.Context, host, port string) *StatusCmd

func (Client) ClusterMyID added in v9.8.0

func (c Client) ClusterMyID(ctx context.Context) *StringCmd

func (Client) ClusterMyShardID added in v9.0.4

func (c Client) ClusterMyShardID(ctx context.Context) *StringCmd

func (Client) ClusterNodes

func (c Client) ClusterNodes(ctx context.Context) *StringCmd

func (Client) ClusterReplicate

func (c Client) ClusterReplicate(ctx context.Context, nodeID string) *StatusCmd

func (Client) ClusterResetHard

func (c Client) ClusterResetHard(ctx context.Context) *StatusCmd

func (Client) ClusterResetSoft

func (c Client) ClusterResetSoft(ctx context.Context) *StatusCmd

func (Client) ClusterSaveConfig

func (c Client) ClusterSaveConfig(ctx context.Context) *StatusCmd

func (Client) ClusterShards added in v9.0.3

func (c Client) ClusterShards(ctx context.Context) *ClusterShardsCmd

func (Client) ClusterSlaves deprecated

func (c Client) ClusterSlaves(ctx context.Context, nodeID string) *StringSliceCmd

ClusterSlaves lists the replica nodes of a master node.

Deprecated: Use ClusterReplicas instead as of Redis 5.0.0.

func (Client) ClusterSlots deprecated

func (c Client) ClusterSlots(ctx context.Context) *ClusterSlotsCmd

ClusterSlots returns the mapping of cluster slots to nodes.

Deprecated: Use ClusterShards instead as of Redis 7.0.0.

func (Client) Command

func (c Client) Command(ctx context.Context) *CommandsInfoCmd

func (Client) CommandGetKeys added in v9.0.3

func (c Client) CommandGetKeys(ctx context.Context, commands ...interface{}) *StringSliceCmd

func (Client) CommandGetKeysAndFlags added in v9.0.3

func (c Client) CommandGetKeysAndFlags(ctx context.Context, commands ...interface{}) *KeyFlagsCmd

func (Client) CommandList added in v9.0.3

func (c Client) CommandList(ctx context.Context, filter *FilterBy) *StringSliceCmd

func (Client) ConfigGet

func (c Client) ConfigGet(ctx context.Context, parameter string) *MapStringStringCmd

func (Client) ConfigResetStat

func (c Client) ConfigResetStat(ctx context.Context) *StatusCmd

func (Client) ConfigRewrite

func (c Client) ConfigRewrite(ctx context.Context) *StatusCmd

func (Client) ConfigSet

func (c Client) ConfigSet(ctx context.Context, parameter, value string) *StatusCmd

func (*Client) Conn

func (c *Client) Conn() *Conn

Conn returns a Conn that runs every command on a single connection borrowed from this client's pool. Close returns that connection to the pool, so any session state left on it (AUTH, SELECT, CLIENT SETNAME, CLIENT TRACKING, ...) is still there for the next pooled caller. Use EphemeralConn when the Conn changes session state.

func (Client) Copy

func (c Client) Copy(ctx context.Context, sourceKey, destKey string, db int, replace bool) *IntCmd

func (Client) DBSize

func (c Client) DBSize(ctx context.Context) *IntCmd

func (Client) DebugObject

func (c Client) DebugObject(ctx context.Context, key string) *StringCmd

func (Client) Decr

func (c Client) Decr(ctx context.Context, key string) *IntCmd

func (Client) DecrBy

func (c Client) DecrBy(ctx context.Context, key string, decrement int64) *IntCmd

func (Client) Del

func (c Client) Del(ctx context.Context, keys ...string) *IntCmd

func (Client) DelExArgs added in v9.17.0

func (c Client) DelExArgs(ctx context.Context, key string, a DelExArgs) *IntCmd

DelExArgs Redis `DELEX key [IFEQ|IFNE|IFDEQ|IFDNE] match-value` command. Compare-and-delete with flexible conditions.

Returns the number of keys that were removed (0 or 1).

NOTE DelExArgs is still experimental it's signature and behaviour may change

func (Client) Digest added in v9.17.0

func (c Client) Digest(ctx context.Context, key string) *DigestCmd

Digest returns the xxh3 hash (uint64) of the specified key's value.

The digest is a 64-bit xxh3 hash that can be used for optimistic locking with SetIFDEQ, SetIFDNE, and DelExArgs commands.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/digest/

NOTE Digest is still experimental it's signature and behaviour may change

func (Client) Do

func (c Client) Do(ctx context.Context, args ...interface{}) *Cmd

func (Client) DoRaw added in v9.19.0

func (c Client) DoRaw(ctx context.Context, args ...interface{}) *RawCmd

DoRaw executes a command and returns the raw RESP protocol bytes without parsing.

func (Client) DoRawWriteTo added in v9.19.0

func (c Client) DoRawWriteTo(ctx context.Context, w io.Writer, args ...interface{}) *RawWriteToCmd

DoRawWriteTo executes a command and streams raw RESP bytes directly to w without intermediate allocations.

func (Client) Dump

func (c Client) Dump(ctx context.Context, key string) *StringCmd

func (Client) Echo

func (c Client) Echo(ctx context.Context, message interface{}) *StringCmd

func (*Client) EphemeralConn added in v9.23.0

func (c *Client) EphemeralConn() *Conn

EphemeralConn is Conn, except Close discards the underlying connection instead of returning it to the pool. Session state a Conn sets (AUTH, SELECT, CLIENT SETNAME, CLIENT TRACKING, RESET, ...) cannot be undone generically on release, so a connection that carried it must not go on to serve unrelated callers. The cost is one dial per EphemeralConn lifetime; Get still reuses an idle pooled connection.

func (Client) Eval

func (c Client) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd

func (Client) EvalRO

func (c Client) EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd

func (Client) EvalSha

func (c Client) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd

func (Client) EvalShaRO

func (c Client) EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd

func (Client) Exists

func (c Client) Exists(ctx context.Context, keys ...string) *IntCmd

func (Client) Expire

func (c Client) Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (Client) ExpireAt

func (c Client) ExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd

func (Client) ExpireGT

func (c Client) ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (Client) ExpireLT

func (c Client) ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (Client) ExpireNX

func (c Client) ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (Client) ExpireTime added in v9.0.3

func (c Client) ExpireTime(ctx context.Context, key string) *DurationCmd

ExpireTime returns the absolute expiration time of key as a Unix timestamp encoded in *DurationCmd (seconds since the epoch), not a remaining TTL. Convert with: time.Unix(int64(d/time.Second), 0). Use TTL/PTTL for remaining TTL.

func (Client) ExpireXX

func (c Client) ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (Client) FCall added in v9.0.3

func (c Client) FCall(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

func (Client) FCallRO added in v9.0.4

func (c Client) FCallRO(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

func (Client) FCallRo added in v9.0.3

func (c Client) FCallRo(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

FCallRo this function simply calls FCallRO, Deprecated: to maintain convention FCallRO.

func (Client) FTAggregate added in v9.5.4

func (c Client) FTAggregate(ctx context.Context, index string, query string) *MapStringInterfaceCmd

FTAggregate - Performs a search query on an index and applies a series of aggregate transformations to the result. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. For more information, please refer to the Redis documentation: [FT.AGGREGATE]: (https://redis.io/commands/ft.aggregate/)

func (Client) FTAggregateWithArgs added in v9.5.4

func (c Client) FTAggregateWithArgs(ctx context.Context, index string, query string, options *FTAggregateOptions) *AggregateCmd

FTAggregateWithArgs - Performs a search query on an index and applies a series of aggregate transformations to the result. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. This function also allows for specifying additional options such as: Verbatim, LoadAll, Load, Timeout, GroupBy, SortBy, SortByMax, Apply, LimitOffset, Limit, Filter, WithCursor, Params, and DialectVersion. For more information, please refer to the Redis documentation: [FT.AGGREGATE]: (https://redis.io/commands/ft.aggregate/)

func (Client) FTAliasAdd added in v9.5.4

func (c Client) FTAliasAdd(ctx context.Context, index string, alias string) *StatusCmd

FTAliasAdd - Adds an alias to an index. The 'index' parameter specifies the index to which the alias is added, and the 'alias' parameter specifies the alias. For more information, please refer to the Redis documentation: [FT.ALIASADD]: (https://redis.io/commands/ft.aliasadd/)

func (Client) FTAliasDel added in v9.5.4

func (c Client) FTAliasDel(ctx context.Context, alias string) *StatusCmd

FTAliasDel - Removes an alias from an index. The 'alias' parameter specifies the alias to be removed. For more information, please refer to the Redis documentation: [FT.ALIASDEL]: (https://redis.io/commands/ft.aliasdel/)

func (Client) FTAliasList added in v9.22.0

func (c Client) FTAliasList(ctx context.Context, index string) *StringSliceCmd

FTAliasList - Lists all aliases associated with an index. The 'index' parameter specifies the index whose aliases are listed; it must be the name of an index created with FT.CREATE, not an alias. The reply is an unordered collection of alias names, already deduplicated by the server; an index with no aliases yields an empty result, not an error. Available since Redis 8.10. For more information, please refer to the Redis documentation: [FT.ALIASLIST]: (https://redis.io/commands/ft.aliaslist/)

func (Client) FTAliasUpdate added in v9.5.4

func (c Client) FTAliasUpdate(ctx context.Context, index string, alias string) *StatusCmd

FTAliasUpdate - Updates an alias to an index. The 'index' parameter specifies the index to which the alias is updated, and the 'alias' parameter specifies the alias. If the alias already exists for a different index, it updates the alias to point to the specified index instead. For more information, please refer to the Redis documentation: [FT.ALIASUPDATE]: (https://redis.io/commands/ft.aliasupdate/)

func (Client) FTAlter added in v9.5.4

func (c Client) FTAlter(ctx context.Context, index string, skipInitialScan bool, definition []interface{}) *StatusCmd

FTAlter - Alters the definition of an existing index. The 'index' parameter specifies the index to alter, and the 'skipInitialScan' parameter specifies whether to skip the initial scan. The 'definition' parameter specifies the new definition for the index. For more information, please refer to the Redis documentation: [FT.ALTER]: (https://redis.io/commands/ft.alter/)

func (Client) FTConfigGet deprecated added in v9.5.4

func (c Client) FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd

Retrieves the value of a RediSearch configuration parameter. The 'option' parameter specifies the configuration parameter to retrieve. For more information, please refer to the Redis FT.CONFIG GET documentation.

Deprecated: FTConfigGet is deprecated in Redis 8. All configuration will be done with the CONFIG GET command. For more information check Client.ConfigGet and CONFIG GET Documentation

func (Client) FTConfigSet deprecated added in v9.5.4

func (c Client) FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd

Sets the value of a RediSearch configuration parameter. The 'option' parameter specifies the configuration parameter to set, and the 'value' parameter specifies the new value. For more information, please refer to the Redis FT.CONFIG SET documentation.

Deprecated: FTConfigSet is deprecated in Redis 8. All configuration will be done with the CONFIG SET command. For more information check Client.ConfigSet and CONFIG SET Documentation

func (Client) FTCreate added in v9.5.4

func (c Client) FTCreate(ctx context.Context, index string, options *FTCreateOptions, schema ...*FieldSchema) *StatusCmd

FTCreate - Creates a new index with the given options and schema. The 'index' parameter specifies the name of the index to create. The 'options' parameter specifies various options for the index, such as: whether to index hashes or JSONs, prefixes, filters, default language, score, score field, payload field, etc. The 'schema' parameter specifies the schema for the index, which includes the field name, field type, etc. For more information, please refer to the Redis documentation: [FT.CREATE]: (https://redis.io/commands/ft.create/)

func (Client) FTCursorDel added in v9.5.4

func (c Client) FTCursorDel(ctx context.Context, index string, cursorId int) *StatusCmd

FTCursorDel - Deletes a cursor from an existing index. The 'index' parameter specifies the index from which to delete the cursor, and the 'cursorId' parameter specifies the ID of the cursor to delete. For more information, please refer to the Redis documentation: [FT.CURSOR DEL]: (https://redis.io/commands/ft.cursor-del/)

func (Client) FTCursorRead added in v9.5.4

func (c Client) FTCursorRead(ctx context.Context, index string, cursorId int, count int) *MapStringInterfaceCmd

FTCursorRead - Reads the next results from an existing cursor. The 'index' parameter specifies the index from which to read the cursor, the 'cursorId' parameter specifies the ID of the cursor to read, and the 'count' parameter specifies the number of results to read. For more information, please refer to the Redis documentation: [FT.CURSOR READ]: (https://redis.io/commands/ft.cursor-read/)

func (Client) FTDictAdd added in v9.5.4

func (c Client) FTDictAdd(ctx context.Context, dict string, term ...interface{}) *IntCmd

FTDictAdd - Adds terms to a dictionary. The 'dict' parameter specifies the dictionary to which to add the terms, and the 'term' parameter specifies the terms to add. For more information, please refer to the Redis documentation: [FT.DICTADD]: (https://redis.io/commands/ft.dictadd/)

func (Client) FTDictDel added in v9.5.4

func (c Client) FTDictDel(ctx context.Context, dict string, term ...interface{}) *IntCmd

FTDictDel - Deletes terms from a dictionary. The 'dict' parameter specifies the dictionary from which to delete the terms, and the 'term' parameter specifies the terms to delete. For more information, please refer to the Redis documentation: [FT.DICTDEL]: (https://redis.io/commands/ft.dictdel/)

func (Client) FTDictDump added in v9.5.4

func (c Client) FTDictDump(ctx context.Context, dict string) *StringSliceCmd

FTDictDump - Returns all terms in the specified dictionary. The 'dict' parameter specifies the dictionary from which to return the terms. For more information, please refer to the Redis documentation: [FT.DICTDUMP]: (https://redis.io/commands/ft.dictdump/)

func (Client) FTDropIndex added in v9.5.4

func (c Client) FTDropIndex(ctx context.Context, index string) *StatusCmd

FTDropIndex - Deletes an index. The 'index' parameter specifies the index to delete. For more information, please refer to the Redis documentation: [FT.DROPINDEX]: (https://redis.io/commands/ft.dropindex/)

func (Client) FTDropIndexWithArgs added in v9.5.4

func (c Client) FTDropIndexWithArgs(ctx context.Context, index string, options *FTDropIndexOptions) *StatusCmd

FTDropIndexWithArgs - Deletes an index with options. The 'index' parameter specifies the index to delete, and the 'options' parameter specifies the DeleteDocs option for docs deletion. For more information, please refer to the Redis documentation: [FT.DROPINDEX]: (https://redis.io/commands/ft.dropindex/)

func (Client) FTExplain added in v9.5.4

func (c Client) FTExplain(ctx context.Context, index string, query string) *StringCmd

FTExplain - Returns the execution plan for a complex query. The 'index' parameter specifies the index to query, and the 'query' parameter specifies the query string. For more information, please refer to the Redis documentation: [FT.EXPLAIN]: (https://redis.io/commands/ft.explain/)

func (Client) FTExplainCli added in v9.5.4

func (c Client) FTExplainCli(ctx context.Context, key, path string) error

FTExplainCli - Returns the execution plan for a complex query. [Not Implemented] For more information, see https://redis.io/commands/ft.explaincli/

func (Client) FTExplainWithArgs added in v9.5.4

func (c Client) FTExplainWithArgs(ctx context.Context, index string, query string, options *FTExplainOptions) *StringCmd

FTExplainWithArgs - Returns the execution plan for a complex query with options. The 'index' parameter specifies the index to query, the 'query' parameter specifies the query string, and the 'options' parameter specifies the Dialect for the query. For more information, please refer to the Redis documentation: [FT.EXPLAIN]: (https://redis.io/commands/ft.explain/)

func (Client) FTHybrid added in v9.17.0

func (c Client) FTHybrid(ctx context.Context, index string, searchExpr string, vectorField string, vectorData Vector) *FTHybridCmd

FTHybrid - Executes a hybrid search combining full-text search and vector similarity The 'index' parameter specifies the index to search, 'searchExpr' is the search query, 'vectorField' is the name of the vector field, and 'vectorData' is the vector to search with. FTHybrid is still experimental, the command behaviour and signature may change

func (Client) FTHybridWithArgs added in v9.17.0

func (c Client) FTHybridWithArgs(ctx context.Context, index string, options *FTHybridOptions) *FTHybridCmd

FTHybridWithArgs - Executes a hybrid search with advanced options FTHybridWithArgs is still experimental, the command behaviour and signature may change

Vector data is always sent through the PARAMS mechanism, because inline vector blobs are no longer supported by Redis. For every vector expression whose VectorParamName is empty, a unique name is generated (e.g. "__vector_param_0") and the corresponding blob is passed via PARAMS.

options.Params is never mutated: the command is built from a local copy that combines the caller-provided params with any generated vector parameters. This makes it safe to reuse the same *FTHybridOptions across multiple calls. Generated names are also reserved against all explicit VectorParamName values, so they never collide with explicit names (even those following the "__vector_param_N" pattern).

func (Client) FTInfo added in v9.5.4

func (c Client) FTInfo(ctx context.Context, index string) *FTInfoCmd

FTInfo - Retrieves information about an index. The 'index' parameter specifies the index to retrieve information about. For more information, please refer to the Redis documentation: [FT.INFO]: (https://redis.io/commands/ft.info/)

func (Client) FTSearch added in v9.5.4

func (c Client) FTSearch(ctx context.Context, index string, query string) *FTSearchCmd

FTSearch - Executes a search query on an index. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. For more information, please refer to the Redis documentation about [FT.SEARCH].

[FT.SEARCH]: (https://redis.io/commands/ft.search/)

func (Client) FTSearchWithArgs added in v9.5.4

func (c Client) FTSearchWithArgs(ctx context.Context, index string, query string, options *FTSearchOptions) *FTSearchCmd

FTSearchWithArgs - Executes a search query on an index with additional options. The 'index' parameter specifies the index to search, the 'query' parameter specifies the search query, and the 'options' parameter specifies additional options for the search. For more information, please refer to the Redis documentation about [FT.SEARCH].

[FT.SEARCH]: (https://redis.io/commands/ft.search/)

func (Client) FTSpellCheck added in v9.5.4

func (c Client) FTSpellCheck(ctx context.Context, index string, query string) *FTSpellCheckCmd

FTSpellCheck - Checks a query string for spelling errors. For more details about spellcheck query please follow: https://redis.io/docs/interact/search-and-query/advanced-concepts/spellcheck/ For more information, please refer to the Redis documentation: [FT.SPELLCHECK]: (https://redis.io/commands/ft.spellcheck/)

func (Client) FTSpellCheckWithArgs added in v9.5.4

func (c Client) FTSpellCheckWithArgs(ctx context.Context, index string, query string, options *FTSpellCheckOptions) *FTSpellCheckCmd

FTSpellCheckWithArgs - Checks a query string for spelling errors with additional options. For more details about spellcheck query please follow: https://redis.io/docs/interact/search-and-query/advanced-concepts/spellcheck/ For more information, please refer to the Redis documentation: [FT.SPELLCHECK]: (https://redis.io/commands/ft.spellcheck/)

func (Client) FTSynDump added in v9.5.4

func (c Client) FTSynDump(ctx context.Context, index string) *FTSynDumpCmd

FTSynDump - Dumps the contents of a synonym group. The 'index' parameter specifies the index to dump. For more information, please refer to the Redis documentation: [FT.SYNDUMP]: (https://redis.io/commands/ft.syndump/)

func (Client) FTSynUpdate added in v9.5.4

func (c Client) FTSynUpdate(ctx context.Context, index string, synGroupId interface{}, terms []interface{}) *StatusCmd

FTSynUpdate - Creates or updates a synonym group with additional terms. The 'index' parameter specifies the index to update, the 'synGroupId' parameter specifies the synonym group id, and the 'terms' parameter specifies the additional terms. For more information, please refer to the Redis documentation: [FT.SYNUPDATE]: (https://redis.io/commands/ft.synupdate/)

func (Client) FTSynUpdateWithArgs added in v9.5.4

func (c Client) FTSynUpdateWithArgs(ctx context.Context, index string, synGroupId interface{}, options *FTSynUpdateOptions, terms []interface{}) *StatusCmd

FTSynUpdateWithArgs - Creates or updates a synonym group with additional terms and options. The 'index' parameter specifies the index to update, the 'synGroupId' parameter specifies the synonym group id, the 'options' parameter specifies additional options for the update, and the 'terms' parameter specifies the additional terms. For more information, please refer to the Redis documentation: [FT.SYNUPDATE]: (https://redis.io/commands/ft.synupdate/)

func (Client) FTTagVals added in v9.5.4

func (c Client) FTTagVals(ctx context.Context, index string, field string) *StringSliceCmd

FTTagVals - Returns all distinct values indexed in a tag field. The 'index' parameter specifies the index to check, and the 'field' parameter specifies the tag field to retrieve values from. For more information, please refer to the Redis documentation: [FT.TAGVALS]: (https://redis.io/commands/ft.tagvals/)

func (Client) FT_List added in v9.5.4

func (c Client) FT_List(ctx context.Context) *StringSliceCmd

FT_List - Lists all the existing indexes in the database. For more information, please refer to the Redis documentation: [FT._LIST]: (https://redis.io/commands/ft._list/)

func (Client) FlushAll

func (c Client) FlushAll(ctx context.Context) *StatusCmd

func (Client) FlushAllAsync

func (c Client) FlushAllAsync(ctx context.Context) *StatusCmd

func (Client) FlushDB

func (c Client) FlushDB(ctx context.Context) *StatusCmd

func (Client) FlushDBAsync

func (c Client) FlushDBAsync(ctx context.Context) *StatusCmd

func (Client) FunctionDelete added in v9.0.3

func (c Client) FunctionDelete(ctx context.Context, libName string) *StringCmd

func (Client) FunctionDump added in v9.0.3

func (c Client) FunctionDump(ctx context.Context) *StringCmd

func (Client) FunctionFlush added in v9.0.3

func (c Client) FunctionFlush(ctx context.Context) *StringCmd

func (Client) FunctionFlushAsync added in v9.0.3

func (c Client) FunctionFlushAsync(ctx context.Context) *StringCmd

func (Client) FunctionKill added in v9.0.3

func (c Client) FunctionKill(ctx context.Context) *StringCmd

func (Client) FunctionList added in v9.0.3

func (c Client) FunctionList(ctx context.Context, q FunctionListQuery) *FunctionListCmd

func (Client) FunctionLoad added in v9.0.3

func (c Client) FunctionLoad(ctx context.Context, code string) *StringCmd

func (Client) FunctionLoadReplace added in v9.0.3

func (c Client) FunctionLoadReplace(ctx context.Context, code string) *StringCmd

func (Client) FunctionRestore added in v9.0.3

func (c Client) FunctionRestore(ctx context.Context, libDump string) *StringCmd

func (Client) FunctionStats added in v9.0.3

func (c Client) FunctionStats(ctx context.Context) *FunctionStatsCmd

func (Client) GeoAdd

func (c Client) GeoAdd(ctx context.Context, key string, geoLocation ...*GeoLocation) *IntCmd

func (Client) GeoDist

func (c Client) GeoDist(
	ctx context.Context, key string, member1, member2, unit string,
) *FloatCmd

func (Client) GeoHash

func (c Client) GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd

func (Client) GeoPos

func (c Client) GeoPos(ctx context.Context, key string, members ...string) *GeoPosCmd

func (Client) GeoRadius deprecated

func (c Client) GeoRadius(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd

GeoRadius queries a geospatial index for members within a distance from a coordinate. This is a read-only variant that does not support Store or StoreDist options.

Deprecated: Use GeoSearch with BYRADIUS argument instead as of Redis 6.2.0.

func (Client) GeoRadiusByMember deprecated

func (c Client) GeoRadiusByMember(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd

GeoRadiusByMember queries a geospatial index for members within a distance from a member. This is a read-only variant that does not support Store or StoreDist options.

Deprecated: Use GeoSearch with BYRADIUS and FROMMEMBER arguments instead as of Redis 6.2.0.

func (Client) GeoRadiusByMemberStore

func (c Client) GeoRadiusByMemberStore(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (Client) GeoRadiusStore

func (c Client) GeoRadiusStore(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (Client) GeoSearch

func (c Client) GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd

func (Client) GeoSearchLocation

func (c Client) GeoSearchLocation(
	ctx context.Context, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd

func (Client) GeoSearchStore

func (c Client) GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd

func (Client) Get

func (c Client) Get(ctx context.Context, key string) *StringCmd

Get Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (Client) GetBit

func (c Client) GetBit(ctx context.Context, key string, offset int64) *IntCmd

func (Client) GetDel

func (c Client) GetDel(ctx context.Context, key string) *StringCmd

GetDel redis-server version >= 6.2.0.

func (Client) GetEx

func (c Client) GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.

func (*Client) GetMaintNotificationsManager added in v9.15.0

func (c *Client) GetMaintNotificationsManager() *maintnotifications.Manager

GetMaintNotificationsManager returns the maintnotifications manager instance for monitoring and control. Returns nil if maintnotifications are not enabled.

func (*Client) GetPushNotificationHandler added in v9.15.0

func (c *Client) GetPushNotificationHandler(pushNotificationName string) push.NotificationHandler

GetPushNotificationHandler returns the handler for a specific push notification name. Returns nil if no handler is registered for the given name.

func (Client) GetRange

func (c Client) GetRange(ctx context.Context, key string, start, end int64) *StringCmd

func (Client) GetSet deprecated

func (c Client) GetSet(ctx context.Context, key string, value interface{}) *StringCmd

GetSet returns the old value stored at key and sets it to the new value.

Deprecated: Use SetArgs with Get option instead as of Redis 6.2.0.

func (Client) GetToBuffer added in v9.21.0

func (c Client) GetToBuffer(ctx context.Context, key string, buf []byte) *ZeroCopyStringCmd

GetToBuffer executes GET and reads the reply directly into buf, avoiding the intermediate string allocation that *StringCmd would produce. For values larger than the connection's read buffer, the payload is read straight from the socket into buf — effectively zero-copy on the receive path.

The returned *ZeroCopyStringCmd reports the number of bytes read via Val(), the populated slice via Bytes() (which is buf[:Val()]), and any error (including redis.Nil when the key does not exist) via Err(). If buf is too small to hold the value, Err() returns a "buffer too small" error.

Nothing is ever written past len(buf). When len(buf) >= value length + 2, the read takes a fast path that pulls the payload and the protocol's trailing CRLF in a single socket read, using the two bytes after the payload as scratch — size buffers with 2 spare bytes to opt in (see example/zerocopy-buffer).

This command opts out of automatic retries because partial data from a failed attempt would already be sitting in the caller's buffer.

func (Client) HDel

func (c Client) HDel(ctx context.Context, key string, fields ...string) *IntCmd

func (Client) HExists

func (c Client) HExists(ctx context.Context, key, field string) *BoolCmd

func (Client) HExpire added in v9.5.4

func (c Client) HExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd

HExpire - Sets the expiration time for specified fields in a hash in seconds. The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HEXPIRE Documentation.

func (Client) HExpireAt added in v9.5.4

func (c Client) HExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd

HExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in seconds. Takes a key, a UNIX timestamp, a struct of conditional flags, and a list of fields. The command sets absolute expiration times based on the UNIX timestamp provided. Available since Redis 7.4 CE. For more information refer to HExpireAt Documentation.

func (Client) HExpireAtWithArgs added in v9.5.4

func (c Client) HExpireAtWithArgs(ctx context.Context, key string, tm time.Time, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

func (Client) HExpireTime added in v9.5.4

func (c Client) HExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd

HExpireTime - Retrieves the expiration time for specified fields in a hash as a UNIX timestamp in seconds. Requires a key and the fields themselves to fetch their expiration timestamps. This command returns the expiration times for each field or error/status codes for each field as specified. Available since Redis 7.4 CE. For more information refer to [HExpireTime Documentation].

[HExpireTime Documentation]: https://redis.io/commands/hexpiretime/ For more information - https://redis.io/commands/hexpiretime/

func (Client) HExpireWithArgs added in v9.5.4

func (c Client) HExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

HExpireWithArgs - Sets the expiration time for specified fields in a hash in seconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HEXPIRE Documentation.

func (Client) HGet

func (c Client) HGet(ctx context.Context, key, field string) *StringCmd

func (Client) HGetAll

func (c Client) HGetAll(ctx context.Context, key string) *MapStringStringCmd

HGetAll returns a map of all fields and values stored at key.

Returns an empty map when key does not exist.

Time complexity: O(N) where N is the size of the hash.

See https://redis.io/commands/hgetall/

func (Client) HGetDel added in v9.8.0

func (c Client) HGetDel(ctx context.Context, key string, fields ...string) *StringSliceCmd

func (Client) HGetEX added in v9.8.0

func (c Client) HGetEX(ctx context.Context, key string, fields ...string) *StringSliceCmd

func (Client) HGetEXWithArgs added in v9.8.0

func (c Client) HGetEXWithArgs(ctx context.Context, key string, options *HGetEXOptions, fields ...string) *StringSliceCmd

func (Client) HImportDiscard added in v9.22.0

func (c Client) HImportDiscard(ctx context.Context, fieldsetName string) *IntCmd

HImportDiscard removes fieldsetName from the executing connection's session and from the client-side registry, stopping further automatic replay:

HIMPORT DISCARD fieldset_name

It returns 1 if the fieldset was registered on this client and is now removed, 0 otherwise (for names never registered through the managed API, the executing connection's session reply passes through unchanged). Pooled connections whose sessions still hold the fieldset replay the DISCARD before their next HIMPORT command, so a subsequent HImportSet fails with "no such fieldset" on every connection, exactly as on a single connection. Hashes already created through the fieldset are not affected.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (Client) HImportDiscardAll added in v9.22.0

func (c Client) HImportDiscardAll(ctx context.Context) *IntCmd

HImportDiscardAll removes all fieldsets from the executing connection's session and clears the client-side registry:

HIMPORT DISCARDALL

It returns the number of fieldsets removed from the client-side registry (when none were registered, the executing connection's session count passes through). Other pooled connections whose sessions were prepared earlier replay HIMPORT DISCARDALL before their next HIMPORT command.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (Client) HImportPrepare added in v9.22.0

func (c Client) HImportPrepare(ctx context.Context, fieldsetName string, fields ...string) *StatusCmd

HImportPrepare registers an ordered list of hash field names under fieldsetName for use by subsequent HImportSet calls:

HIMPORT PREPARE fieldset_name field [field ...]

The server keeps the fieldset in the session of the connection that executed the command. On pooled clients (Client, Conn, Pipeline, Tx) the fieldset is also remembered client-side and the PREPARE is replayed lazily — at most once per connection session — on any pooled connection about to execute an HImportSet referencing it, so HImportSet works transparently across the pool. Preparing an existing fieldset name again silently replaces it.

ClusterClient and Ring override this method (see himport_cluster.go): the fieldset registers in a registry shared by every node/shard client and the PREPARE additionally fans out eagerly to all masters/shards.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (Client) HImportSet added in v9.22.0

func (c Client) HImportSet(ctx context.Context, key, fieldsetName string, values ...interface{}) *StatusCmd

HImportSet creates or fully replaces the hash at key using the field list registered under fieldsetName, pairing values positionally with the prepared fields:

HIMPORT SET key fieldset_name value [value ...]

The number of values must equal the fieldset's field count. The resulting key is a regular hash readable and writable by all hash commands. If the fieldset was registered through HImportPrepare on this client, it is prepared automatically on whichever pooled connection executes the command; otherwise the fieldset must have been prepared on the executing connection or the server replies "ERR no such fieldset".

"no such fieldset" never surfaces for a registered fieldset: a single-command HImportSet whose connection lost its session state (e.g. RESET) is transparently re-prepared and retried once — the failure also stales every other connection's prepared flag, so the retry re-prepares wherever it lands, and this recovery attempt is granted even when retries are disabled (MaxRetries -1). In pipelines the failed HImportSets — and only those — are re-prepared and re-issued once on the same connection (HIMPORT SET is a full replace, so the re-execution is idempotent and no other command of the batch runs again). Inside transactions the error does surface after EXEC — an executed transaction cannot be partially re-run — but the prepared flags are invalidated, so retrying the transaction succeeds.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (Client) HIncrBy

func (c Client) HIncrBy(ctx context.Context, key, field string, incr int64) *IntCmd

func (Client) HIncrByFloat

func (c Client) HIncrByFloat(ctx context.Context, key, field string, incr float64) *FloatCmd

func (Client) HKeys

func (c Client) HKeys(ctx context.Context, key string) *StringSliceCmd

func (Client) HLen

func (c Client) HLen(ctx context.Context, key string) *IntCmd

func (Client) HMGet

func (c Client) HMGet(ctx context.Context, key string, fields ...string) *SliceCmd

HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.

func (Client) HMSet

func (c Client) HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (Client) HPExpire added in v9.5.4

func (c Client) HPExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd

HPExpire - Sets the expiration time for specified fields in a hash in milliseconds. Similar to HExpire, it accepts a key, an expiration duration in milliseconds, a struct with expiration condition flags, and a list of fields. The command modifies the standard time.Duration to milliseconds for the Redis command. Available since Redis 7.4 CE. For more information refer to HPEXPIRE Documentation.

func (Client) HPExpireAt added in v9.5.4

func (c Client) HPExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd

HPExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in milliseconds. Similar to HExpireAt but for timestamps in milliseconds. It accepts the same parameters and adjusts the UNIX time to milliseconds. Available since Redis 7.4 CE. For more information refer to HExpireAt Documentation.

func (Client) HPExpireAtWithArgs added in v9.5.4

func (c Client) HPExpireAtWithArgs(ctx context.Context, key string, tm time.Time, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

func (Client) HPExpireTime added in v9.5.4

func (c Client) HPExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPExpireTime - Retrieves the expiration time for specified fields in a hash as a UNIX timestamp in milliseconds. Similar to HExpireTime, adjusted for timestamps in milliseconds. It requires the same parameters. Provides the expiration timestamp for each field in milliseconds. Available since Redis 7.4 CE. For more information refer to [HExpireTime Documentation].

[HExpireTime Documentation]: https://redis.io/commands/hexpiretime/ For more information - https://redis.io/commands/hexpiretime/

func (Client) HPExpireWithArgs added in v9.5.4

func (c Client) HPExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

HPExpireWithArgs - Sets the expiration time for specified fields in a hash in milliseconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HPEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HPEXPIRE Documentation.

func (Client) HPTTL added in v9.5.4

func (c Client) HPTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPTTL - Retrieves the remaining time to live for specified fields in a hash in milliseconds. Similar to HTTL, but returns the TTL in milliseconds. It requires a key and the specified fields. This command provides the TTL in milliseconds for each field or returns error/status codes as needed. Available since Redis 7.4 CE. For more information refer to [HPTTL Documentation].

[HPTTL Documentation]: https://redis.io/commands/hpttl/ For more information - https://redis.io/commands/hpttl/

func (Client) HPersist added in v9.5.4

func (c Client) HPersist(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPersist - Removes the expiration time from specified fields in a hash. Accepts a key and the fields themselves. This command ensures that each field specified will have its expiration removed if present. Available since Redis 7.4 CE. For more information refer to HPersist Documentation.

func (Client) HRandField

func (c Client) HRandField(ctx context.Context, key string, count int) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (Client) HRandFieldWithValues

func (c Client) HRandFieldWithValues(ctx context.Context, key string, count int) *KeyValueSliceCmd

HRandFieldWithValues redis-server version >= 6.2.0.

func (Client) HScan

func (c Client) HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (Client) HScanNoValues added in v9.5.4

func (c Client) HScanNoValues(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (Client) HSet

func (c Client) HSet(ctx context.Context, key string, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet(ctx, "myhash", "key1", "value1", "key2", "value2")

  • HSet(ctx, "myhash", []string{"key1", "value1", "key2", "value2"})

  • HSet(ctx, "myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

    Playing struct With "redis" tag. type MyHash struct { Key1 string `redis:"key1"`; Key2 int `redis:"key2"` }

  • HSet(ctx, "myhash", MyHash{"value1", "value2"}) Warn: redis-server >= 4.0

    For struct, can be a structure pointer type, we only parse the field whose tag is redis. if you don't want the field to be read, you can use the `redis:"-"` flag to ignore it, or you don't need to set the redis tag. For the type of structure field, we only support simple data types: string, int/uint(8,16,32,64), float(32,64), time.Time(to RFC3339Nano), time.Duration(to Nanoseconds ), if you are other more complex or custom data types, please implement the encoding.BinaryMarshaler interface.

Note that in older versions of Redis server(redis-server < 4.0), HSet only supports a single key-value pair. redis-docs: https://redis.io/commands/hset (Starting with Redis version 4.0.0: Accepts multiple field and value arguments.) If you are using a Struct type and the number of fields is greater than one, you will receive an error similar to "ERR wrong number of arguments", you can use HMSet as a substitute.

Example
package main

import (
	"context"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	// Set "redis" tag for hash key
	type ExampleUser struct {
		Name string `redis:"name"`
		Age  int    `redis:"age"`
	}

	items := ExampleUser{"jane", 22}

	err := rdb.HSet(ctx, "user:1", items).Err()
	if err != nil {
		panic(err)
	}
}

func (Client) HSetEX added in v9.8.0

func (c Client) HSetEX(ctx context.Context, key string, fieldsAndValues ...string) *IntCmd

func (Client) HSetEXWithArgs added in v9.8.0

func (c Client) HSetEXWithArgs(ctx context.Context, key string, options *HSetEXOptions, fieldsAndValues ...string) *IntCmd

func (Client) HSetNX

func (c Client) HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd

func (Client) HStrLen added in v9.8.0

func (c Client) HStrLen(ctx context.Context, key, field string) *IntCmd

func (Client) HTTL added in v9.5.4

func (c Client) HTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd

HTTL - Retrieves the remaining time to live for specified fields in a hash in seconds. Requires a key and the fields themselves. It returns the TTL for each specified field. This command fetches the TTL in seconds for each field or returns error/status codes as appropriate. Available since Redis 7.4 CE. For more information refer to HTTL Documentation.

func (Client) HVals

func (c Client) HVals(ctx context.Context, key string) *StringSliceCmd

func (*Client) HotKeysGet added in v9.18.0

func (c *Client) HotKeysGet(ctx context.Context) *HotKeysCmd

HotKeysGet retrieves the results of the ongoing or last hotkeys collection session. This command is only available on standalone clients.

func (*Client) HotKeysReset added in v9.18.0

func (c *Client) HotKeysReset(ctx context.Context) *StatusCmd

HotKeysReset discards the last hotkeys collection session results. Returns an error if tracking is currently active. This command is only available on standalone clients.

func (*Client) HotKeysStart added in v9.18.0

func (c *Client) HotKeysStart(ctx context.Context, args *HotKeysStartArgs) *StatusCmd

HotKeysStart starts collecting hotkeys data. At least one metric must be specified in args.Metrics. This command is only available on standalone clients.

func (*Client) HotKeysStop added in v9.18.0

func (c *Client) HotKeysStop(ctx context.Context) *StatusCmd

HotKeysStop stops the ongoing hotkeys collection session. This command is only available on standalone clients.

func (Client) Incr

func (c Client) Incr(ctx context.Context, key string) *IntCmd
Example
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	result, err := rdb.Incr(ctx, "counter").Result()
	if err != nil {
		panic(err)
	}

	fmt.Println(result)
}
Output:
1

func (Client) IncrBy

func (c Client) IncrBy(ctx context.Context, key string, value int64) *IntCmd

func (Client) IncrByFloat

func (c Client) IncrByFloat(ctx context.Context, key string, value float64) *FloatCmd

func (Client) IncrEXFloat added in v9.20.0

func (c Client) IncrEXFloat(ctx context.Context, key string, a IncrEXFloatArgs) *IncrEXFloatCmd

IncrEXFloat Redis `INCREX key [BYFLOAT amount] [LBOUND value] [UBOUND value] [SATURATE] [EX seconds | PX ms | EXAT ts | PXAT ts | PERSIST] [ENX]` command.

Available since Redis 8.8. For more information, see https://redis.io/commands/increx

func (Client) IncrEXInt added in v9.20.0

func (c Client) IncrEXInt(ctx context.Context, key string, a IncrEXIntArgs) *IncrEXIntCmd

IncrEXInt Redis `INCREX key [BYINT amount] [LBOUND value] [UBOUND value] [SATURATE] [EX seconds | PX ms | EXAT ts | PXAT ts | PERSIST] [ENX]` command.

Atomically increments the integer value stored at key, optionally constraining the result to a range and applying expiration semantics. Returns the new value and the increment that was actually applied. When the increment would exceed LBOUND/UBOUND and SATURATE is not set, the key and TTL are left unchanged and the reply is [current_value, 0].

Available since Redis 8.8. For more information, see https://redis.io/commands/increx

func (Client) Info

func (c Client) Info(ctx context.Context, sections ...string) *StringCmd

func (Client) InfoMap added in v9.3.0

func (c Client) InfoMap(ctx context.Context, sections ...string) *InfoCmd

func (Client) JSONArrAppend added in v9.3.0

func (c Client) JSONArrAppend(ctx context.Context, key, path string, values ...interface{}) *IntSliceCmd

JSONArrAppend adds the provided JSON values to the end of the array at the given path. For more information, see https://redis.io/commands/json.arrappend

func (Client) JSONArrIndex added in v9.3.0

func (c Client) JSONArrIndex(ctx context.Context, key, path string, value ...interface{}) *IntSliceCmd

JSONArrIndex searches for the first occurrence of the provided JSON value in the array at the given path. For more information, see https://redis.io/commands/json.arrindex

func (Client) JSONArrIndexWithArgs added in v9.3.0

func (c Client) JSONArrIndexWithArgs(ctx context.Context, key, path string, options *JSONArrIndexArgs, value ...interface{}) *IntSliceCmd

JSONArrIndexWithArgs searches for the first occurrence of a JSON value in an array while allowing the start and stop options to be provided. For more information, see https://redis.io/commands/json.arrindex

func (Client) JSONArrInsert added in v9.3.0

func (c Client) JSONArrInsert(ctx context.Context, key, path string, index int64, values ...interface{}) *IntSliceCmd

JSONArrInsert inserts the JSON values into the array at the specified path before the index (shifts to the right). For more information, see https://redis.io/commands/json.arrinsert

func (Client) JSONArrLen added in v9.3.0

func (c Client) JSONArrLen(ctx context.Context, key, path string) *IntSliceCmd

JSONArrLen reports the length of the JSON array at the specified path in the given key. For more information, see https://redis.io/commands/json.arrlen

func (Client) JSONArrPop added in v9.3.0

func (c Client) JSONArrPop(ctx context.Context, key, path string, index int) *StringSliceCmd

JSONArrPop removes and returns an element from the specified index in the array. For more information, see https://redis.io/commands/json.arrpop

func (Client) JSONArrTrim added in v9.3.0

func (c Client) JSONArrTrim(ctx context.Context, key, path string) *IntSliceCmd

JSONArrTrim trims an array to contain only the specified inclusive range of elements. For more information, see https://redis.io/commands/json.arrtrim

func (Client) JSONArrTrimWithArgs added in v9.3.0

func (c Client) JSONArrTrimWithArgs(ctx context.Context, key, path string, options *JSONArrTrimArgs) *IntSliceCmd

JSONArrTrimWithArgs trims an array to contain only the specified inclusive range of elements. For more information, see https://redis.io/commands/json.arrtrim

func (Client) JSONClear added in v9.3.0

func (c Client) JSONClear(ctx context.Context, key, path string) *IntCmd

JSONClear clears container values (arrays/objects) and sets numeric values to 0. For more information, see https://redis.io/commands/json.clear

func (Client) JSONDebugMemory added in v9.3.0

func (c Client) JSONDebugMemory(ctx context.Context, key, path string) *IntCmd

JSONDebugMemory reports a value's memory usage in bytes (unimplemented) For more information, see https://redis.io/commands/json.debug-memory

func (Client) JSONDel added in v9.3.0

func (c Client) JSONDel(ctx context.Context, key, path string) *IntCmd

JSONDel deletes a value. For more information, see https://redis.io/commands/json.del

func (Client) JSONForget added in v9.3.0

func (c Client) JSONForget(ctx context.Context, key, path string) *IntCmd

JSONForget deletes a value. For more information, see https://redis.io/commands/json.forget

func (Client) JSONGet added in v9.3.0

func (c Client) JSONGet(ctx context.Context, key string, paths ...string) *JSONCmd

JSONGet returns the value at path in JSON serialized form. JSON.GET returns an array of strings. This function parses out the wrapping array but leaves the internal strings unprocessed by default (see Val()) For more information - https://redis.io/commands/json.get/

func (Client) JSONGetWithArgs added in v9.3.0

func (c Client) JSONGetWithArgs(ctx context.Context, key string, options *JSONGetArgs, paths ...string) *JSONCmd

JSONGetWithArgs - Retrieves the value of a key from a JSON document. This function also allows for specifying additional options such as: Indention, NewLine and Space For more information - https://redis.io/commands/json.get/

func (Client) JSONMGet added in v9.3.0

func (c Client) JSONMGet(ctx context.Context, path string, keys ...string) *JSONSliceCmd

JSONMGet returns the values at the specified path from multiple key arguments. Note - the arguments are reversed when compared with `JSON.MGET` as we want to follow the pattern of having the last argument be variable. For more information, see https://redis.io/commands/json.mget

func (Client) JSONMSet added in v9.3.0

func (c Client) JSONMSet(ctx context.Context, params ...interface{}) *StatusCmd

func (Client) JSONMSetArgs added in v9.3.0

func (c Client) JSONMSetArgs(ctx context.Context, docs []JSONSetArgs) *StatusCmd

JSONMSetArgs sets or updates one or more JSON values according to the specified key-path-value triplets. For more information, see https://redis.io/commands/json.mset

func (Client) JSONMerge added in v9.3.0

func (c Client) JSONMerge(ctx context.Context, key, path string, value string) *StatusCmd

JSONMerge merges a given JSON value into matching paths. For more information, see https://redis.io/commands/json.merge

func (Client) JSONNumIncrBy added in v9.3.0

func (c Client) JSONNumIncrBy(ctx context.Context, key, path string, value float64) *JSONCmd

JSONNumIncrBy increments the number value stored at the specified path by the provided number. For more information, see https://redis.io/docs/latest/commands/json.numincrby/

func (Client) JSONObjKeys added in v9.3.0

func (c Client) JSONObjKeys(ctx context.Context, key, path string) *SliceCmd

JSONObjKeys returns the keys in the object that's referenced by the specified path. For more information, see https://redis.io/commands/json.objkeys

func (Client) JSONObjLen added in v9.3.0

func (c Client) JSONObjLen(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONObjLen reports the number of keys in the JSON object at the specified path in the given key. For more information, see https://redis.io/commands/json.objlen

func (Client) JSONSet added in v9.3.0

func (c Client) JSONSet(ctx context.Context, key, path string, value interface{}) *StatusCmd

JSONSet sets the JSON value at the given path in the given key. The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or a []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (Client) JSONSetMode added in v9.3.0

func (c Client) JSONSetMode(ctx context.Context, key, path string, value interface{}, mode string) *StatusCmd

JSONSetMode sets the JSON value at the given path in the given key and allows the mode to be set (the mode value must be "XX" or "NX"). The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (Client) JSONSetWithArgs added in v9.20.0

func (c Client) JSONSetWithArgs(ctx context.Context, key, path string, value interface{}, options *JSONSetArgsOptions) *StatusCmd

JSONSetWithArgs sets the JSON value at the given path in the given key with optional arguments for setting mode (NX/XX) and the FPHA (Floating-Point Homogeneous Array) type used for storing FP arrays. The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (Client) JSONStrAppend added in v9.3.0

func (c Client) JSONStrAppend(ctx context.Context, key, path, value string) *IntPointerSliceCmd

JSONStrAppend appends the JSON-string values to the string at the specified path. For more information, see https://redis.io/commands/json.strappend

func (Client) JSONStrLen added in v9.3.0

func (c Client) JSONStrLen(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONStrLen reports the length of the JSON String at the specified path in the given key. For more information, see https://redis.io/commands/json.strlen

func (Client) JSONToggle added in v9.3.0

func (c Client) JSONToggle(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONToggle toggles a Boolean value stored at the specified path. For more information, see https://redis.io/commands/json.toggle

func (Client) JSONType added in v9.3.0

func (c Client) JSONType(ctx context.Context, key, path string) *JSONSliceCmd

JSONType reports the type of JSON value at the specified path. For more information, see https://redis.io/commands/json.type

func (Client) Keys

func (c Client) Keys(ctx context.Context, pattern string) *StringSliceCmd

func (Client) LCS added in v9.0.3

func (c Client) LCS(ctx context.Context, q *LCSQuery) *LCSCmd

func (Client) LIndex

func (c Client) LIndex(ctx context.Context, key string, index int64) *StringCmd

func (Client) LInsert

func (c Client) LInsert(ctx context.Context, key, op string, pivot, value interface{}) *IntCmd

func (Client) LInsertAfter

func (c Client) LInsertAfter(ctx context.Context, key string, pivot, value interface{}) *IntCmd

func (Client) LInsertBefore

func (c Client) LInsertBefore(ctx context.Context, key string, pivot, value interface{}) *IntCmd

func (Client) LLen

func (c Client) LLen(ctx context.Context, key string) *IntCmd

func (Client) LMPop added in v9.0.3

func (c Client) LMPop(ctx context.Context, direction string, count int64, keys ...string) *KeyValuesCmd

LMPop Pops one or more elements from the first non-empty list key from the list of provided key names. direction: left or right, count: > 0 example: client.LMPop(ctx, "left", 3, "key1", "key2")

func (Client) LMove

func (c Client) LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd

func (Client) LMoveM added in v9.22.0

func (c Client) LMoveM(ctx context.Context, source, destination, srcpos, destpos string, a LMoveMArgs) *StringSliceCmd

LMoveM atomically moves multiple elements between lists (Redis 8.10+). srcpos/destpos are "LEFT" or "RIGHT". Returns moved elements, or redis.Nil if none.

func (Client) LPop

func (c Client) LPop(ctx context.Context, key string) *StringCmd

func (Client) LPopCount

func (c Client) LPopCount(ctx context.Context, key string, count int) *StringSliceCmd

func (Client) LPos

func (c Client) LPos(ctx context.Context, key string, value string, a LPosArgs) *IntCmd

func (Client) LPosCount

func (c Client) LPosCount(ctx context.Context, key string, value string, count int64, a LPosArgs) *IntSliceCmd

func (Client) LPush

func (c Client) LPush(ctx context.Context, key string, values ...interface{}) *IntCmd

func (Client) LPushX

func (c Client) LPushX(ctx context.Context, key string, values ...interface{}) *IntCmd

func (Client) LRange

func (c Client) LRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

func (Client) LRem

func (c Client) LRem(ctx context.Context, key string, count int64, value interface{}) *IntCmd

func (Client) LSet

func (c Client) LSet(ctx context.Context, key string, index int64, value interface{}) *StatusCmd

func (Client) LTrim

func (c Client) LTrim(ctx context.Context, key string, start, stop int64) *StatusCmd

func (Client) LastSave

func (c Client) LastSave(ctx context.Context) *IntCmd

func (Client) Latency added in v9.17.0

func (c Client) Latency(ctx context.Context) *LatencyCmd

func (Client) LatencyReset added in v9.17.0

func (c Client) LatencyReset(ctx context.Context, events ...interface{}) *StatusCmd

func (Client) MGet

func (c Client) MGet(ctx context.Context, keys ...string) *SliceCmd

func (Client) MSet

func (c Client) MSet(ctx context.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
  • MSet(struct), For struct types, see HSet description.

func (Client) MSetEX added in v9.17.0

func (c Client) MSetEX(ctx context.Context, args MSetEXArgs, values ...interface{}) *IntCmd

MSetEX sets the given keys to their respective values. This command is an extension of the MSETNX that adds expiration and XX options. Available since Redis 8.4 Important: When this method is used with Cluster clients, all keys must be in the same hash slot, otherwise CROSSSLOT error will be returned. For more information, see https://redis.io/commands/msetex

func (Client) MSetNX

func (c Client) MSetNX(ctx context.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
  • MSetNX(struct), For struct types, see HSet description.

func (Client) MemoryUsage

func (c Client) MemoryUsage(ctx context.Context, key string, samples ...int) *IntCmd

func (Client) Migrate

func (c Client) Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd

func (Client) ModuleLoadex added in v9.0.4

func (c Client) ModuleLoadex(ctx context.Context, conf *ModuleLoadexConfig) *StringCmd

ModuleLoadex Redis `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]` command.

func (Client) Monitor added in v9.3.1

func (c Client) Monitor(ctx context.Context, ch chan string) *MonitorCmd

Monitor - represents a Redis MONITOR command, allowing the user to capture and process all commands sent to a Redis server. This mimics the behavior of MONITOR in the redis-cli.

Notes: - Using MONITOR blocks the connection to the server for itself. It needs a dedicated connection - The user should create a channel of type string - This runs concurrently in the background. Trigger via the Start and Stop functions See further: Redis MONITOR command: https://redis.io/commands/monitor

func (Client) Move

func (c Client) Move(ctx context.Context, key string, db int) *BoolCmd

func (*Client) NewAggregateBuilder added in v9.12.0

func (c *Client) NewAggregateBuilder(ctx context.Context, index, query string) *AggregateBuilder

NewAggregateBuilder creates a new AggregateBuilder for FT.AGGREGATE commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewAliasBuilder added in v9.12.0

func (c *Client) NewAliasBuilder(ctx context.Context, alias string) *AliasBuilder

NewAliasBuilder creates a new AliasBuilder for FT.ALIAS* commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewCreateIndexBuilder added in v9.12.0

func (c *Client) NewCreateIndexBuilder(ctx context.Context, index string) *CreateIndexBuilder

NewCreateIndexBuilder creates a new CreateIndexBuilder for FT.CREATE commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewCursorBuilder added in v9.12.0

func (c *Client) NewCursorBuilder(ctx context.Context, index string, cursorId int64) *CursorBuilder

NewCursorBuilder creates a new CursorBuilder for FT.CURSOR* commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewDictBuilder added in v9.12.0

func (c *Client) NewDictBuilder(ctx context.Context, dict string) *DictBuilder

NewDictBuilder creates a new DictBuilder for FT.DICT* commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewDropIndexBuilder added in v9.12.0

func (c *Client) NewDropIndexBuilder(ctx context.Context, index string) *DropIndexBuilder

NewDropIndexBuilder creates a new DropIndexBuilder for FT.DROPINDEX commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewExplainBuilder added in v9.12.0

func (c *Client) NewExplainBuilder(ctx context.Context, index, query string) *ExplainBuilder

NewExplainBuilder creates a new ExplainBuilder for FT.EXPLAIN commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewSearchBuilder added in v9.12.0

func (c *Client) NewSearchBuilder(ctx context.Context, index, query string) *SearchBuilder

NewSearchBuilder creates a new SearchBuilder for FT.SEARCH commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewSearchInfoBuilder added in v9.12.0

func (c *Client) NewSearchInfoBuilder(ctx context.Context, index string) *FTInfoBuilder

NewSearchInfoBuilder creates a new FTInfoBuilder for FT.INFO commands.

func (*Client) NewSpellCheckBuilder added in v9.12.0

func (c *Client) NewSpellCheckBuilder(ctx context.Context, index, query string) *SpellCheckBuilder

NewSpellCheckBuilder creates a new SpellCheckBuilder for FT.SPELLCHECK commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewSynUpdateBuilder added in v9.12.0

func (c *Client) NewSynUpdateBuilder(ctx context.Context, index string, groupId interface{}) *SynUpdateBuilder

NewSynUpdateBuilder creates a new SynUpdateBuilder for FT.SYNUPDATE commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NewTagValsBuilder added in v9.12.0

func (c *Client) NewTagValsBuilder(ctx context.Context, index, field string) *TagValsBuilder

NewTagValsBuilder creates a new TagValsBuilder for FT.TAGVALS commands. EXPERIMENTAL: this API is subject to change, use with caution.

func (*Client) NodeAddress added in v9.18.0

func (c *Client) NodeAddress() string

NodeAddress returns the address of the Redis node as reported by the server. For cluster clients, this is the endpoint from CLUSTER SLOTS before any transformation (e.g., loopback replacement). For standalone clients, this defaults to Addr.

This is useful for matching the source field in maintenance notifications (e.g. SMIGRATED).

func (Client) ObjectEncoding

func (c Client) ObjectEncoding(ctx context.Context, key string) *StringCmd

func (Client) ObjectFreq added in v9.5.0

func (c Client) ObjectFreq(ctx context.Context, key string) *IntCmd

func (Client) ObjectIdleTime

func (c Client) ObjectIdleTime(ctx context.Context, key string) *DurationCmd

func (Client) ObjectRefCount

func (c Client) ObjectRefCount(ctx context.Context, key string) *IntCmd

func (*Client) Options

func (c *Client) Options() *Options

Options returns read-only *Options that were used to create the client. Any alteration of the returned *Options may result in undefined behaviour.

func (Client) PExpire

func (c Client) PExpire(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (Client) PExpireAt

func (c Client) PExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd

func (Client) PExpireTime added in v9.0.3

func (c Client) PExpireTime(ctx context.Context, key string) *DurationCmd

PExpireTime returns the absolute expiration time of key as a Unix timestamp encoded in *DurationCmd (milliseconds since the epoch), not a remaining TTL. Convert with: time.UnixMilli(int64(d/time.Millisecond)). Use TTL/PTTL for remaining TTL.

func (Client) PFAdd

func (c Client) PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd

func (Client) PFCount

func (c Client) PFCount(ctx context.Context, keys ...string) *IntCmd

func (Client) PFMerge

func (c Client) PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd

func (*Client) PSubscribe

func (c *Client) PSubscribe(ctx context.Context, channels ...string) *PubSub

PSubscribe subscribes the client to the given patterns. Patterns can be omitted to create empty subscription.

func (Client) PTTL

func (c Client) PTTL(ctx context.Context, key string) *DurationCmd

func (Client) Persist

func (c Client) Persist(ctx context.Context, key string) *BoolCmd

func (Client) Ping

func (c Client) Ping(ctx context.Context) *StatusCmd

func (*Client) Pipeline

func (c *Client) Pipeline() Pipeliner
Example
package main

import (
	"context"
	"fmt"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	pipe := rdb.Pipeline()

	incr := pipe.Incr(ctx, "pipeline_counter")
	pipe.Expire(ctx, "pipeline_counter", time.Hour)

	// Execute
	//
	//     INCR pipeline_counter
	//     EXPIRE pipeline_counts 3600
	//
	// using one rdb-server roundtrip.
	_, err := pipe.Exec(ctx)
	fmt.Println(incr.Val(), err)
}
Output:
1 <nil>

func (*Client) Pipelined

func (c *Client) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
Example
package main

import (
	"context"
	"fmt"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	var incr *redis.IntCmd
	_, err := rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {
		incr = pipe.Incr(ctx, "pipelined_counter")
		pipe.Expire(ctx, "pipelined_counter", time.Hour)
		return nil
	})
	fmt.Println(incr.Val(), err)
}
Output:
1 <nil>

func (*Client) PoolStats

func (c *Client) PoolStats() *PoolStats

PoolStats returns connection pool stats.

func (*Client) Process

func (c *Client) Process(ctx context.Context, cmd Cmder) error

func (Client) PubSubChannels

func (c Client) PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd

func (Client) PubSubNumPat

func (c Client) PubSubNumPat(ctx context.Context) *IntCmd

func (Client) PubSubNumSub

func (c Client) PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd

func (Client) PubSubShardChannels

func (c Client) PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd

func (Client) PubSubShardNumSub

func (c Client) PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd

func (Client) Publish

func (c Client) Publish(ctx context.Context, channel string, message interface{}) *IntCmd

Publish posts the message to the channel.

func (Client) Quit deprecated

func (c Client) Quit(_ context.Context) *StatusCmd

Quit closes the connection.

Deprecated: Just close the connection instead as of Redis 7.2.0.

func (Client) RPop

func (c Client) RPop(ctx context.Context, key string) *StringCmd

func (Client) RPopCount

func (c Client) RPopCount(ctx context.Context, key string, count int) *StringSliceCmd

func (Client) RPopLPush deprecated

func (c Client) RPopLPush(ctx context.Context, source, destination string) *StringCmd

RPopLPush atomically returns and removes the last element of the source list, and pushes the element as the first element of the destination list.

Deprecated: Use LMove with RIGHT and LEFT arguments instead as of Redis 6.2.0.

func (Client) RPush

func (c Client) RPush(ctx context.Context, key string, values ...interface{}) *IntCmd

func (Client) RPushX

func (c Client) RPushX(ctx context.Context, key string, values ...interface{}) *IntCmd

func (Client) RandomKey

func (c Client) RandomKey(ctx context.Context) *StringCmd

func (Client) ReadOnly

func (c Client) ReadOnly(ctx context.Context) *StatusCmd

func (Client) ReadWrite

func (c Client) ReadWrite(ctx context.Context) *StatusCmd

func (*Client) RegisterPushNotificationHandler added in v9.15.0

func (c *Client) RegisterPushNotificationHandler(pushNotificationName string, handler push.NotificationHandler, protected bool) error

RegisterPushNotificationHandler registers a handler for a specific push notification name. Returns an error if a handler is already registered for this push notification name. If protected is true, the handler cannot be unregistered.

func (Client) Rename

func (c Client) Rename(ctx context.Context, key, newkey string) *StatusCmd

func (Client) RenameNX

func (c Client) RenameNX(ctx context.Context, key, newkey string) *BoolCmd

func (Client) ReplicaOf added in v9.19.0

func (c Client) ReplicaOf(ctx context.Context, host, port string) *StatusCmd

ReplicaOf sets a Redis server as a replica of another, or promotes it to being a master.

func (Client) Restore

func (c Client) Restore(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd

func (Client) RestoreReplace

func (c Client) RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd

func (Client) SAdd

func (c Client) SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd

Returns the number of elements that were added to the set, not including all the elements already present in the set.

For more information about the command please refer to [SADD].

[SADD]: (https://redis.io/docs/latest/commands/sadd/)

func (Client) SCard

func (c Client) SCard(ctx context.Context, key string) *IntCmd

Returns the set cardinality (number of elements) of the set stored at key. Returns 0 if key does not exist.

For more information about the command please refer to [SCARD].

[SCARD]: (https://redis.io/docs/latest/commands/scard/)

func (Client) SDiff

func (c Client) SDiff(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the difference between the first set and all the successive sets. Keys that do not exist are considered to be empty sets.

For more information about the command please refer to [SDIFF].

[SDIFF]: (https://redis.io/docs/latest/commands/sdiff/)

func (Client) SDiffCard added in v9.22.0

func (c Client) SDiffCard(ctx context.Context, opts *SDiffCardOptions, keys ...string) *IntCmd

Returns the cardinality of the difference of the first set and the rest. Missing keys are treated as empty sets.

For more information about the command please refer to [SDIFFCARD].

[SDIFFCARD]: (https://redis.io/docs/latest/commands/sdiffcard/)

func (Client) SDiffStore

func (c Client) SDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the difference between the first set and all the successive sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SDIFFSTORE].

[SDIFFSTORE]: (https://redis.io/docs/latest/commands/sdiffstore/)

func (Client) SInter

func (c Client) SInter(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the intersection of all the given sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty.

For more information about the command please refer to [SINTER].

[SINTER]: (https://redis.io/docs/latest/commands/sinter/)

func (Client) SInterCard

func (c Client) SInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd

Returns the cardinality of the set resulting from the intersection of all the given sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty.

The limit parameter sets an upper bound on the number of results returned. If limit is 0, no limit is applied.

For more information about the command please refer to [SINTERCARD].

[SINTERCARD]: (https://redis.io/docs/latest/commands/sintercard/)

func (Client) SInterStore

func (c Client) SInterStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the intersection of all the given sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SINTERSTORE].

[SINTERSTORE]: (https://redis.io/docs/latest/commands/sinterstore/)

func (Client) SIsMember

func (c Client) SIsMember(ctx context.Context, key string, member interface{}) *BoolCmd

Returns if member is a member of the set stored at key. Returns true if the element is a member of the set, false if it is not a member or if key does not exist.

For more information about the command please refer to [SISMEMBER].

[SISMEMBER]: (https://redis.io/docs/latest/commands/sismember/)

func (Client) SMIsMember

func (c Client) SMIsMember(ctx context.Context, key string, members ...interface{}) *BoolSliceCmd

Returns whether each member is a member of the set stored at key. For each member, returns true if the element is a member of the set, false if it is not a member or if key does not exist.

For more information about the command please refer to [SMISMEMBER].

[SMISMEMBER]: (https://redis.io/docs/latest/commands/smismember/)

func (Client) SMembers

func (c Client) SMembers(ctx context.Context, key string) *StringSliceCmd

Returns all the members of the set value stored at key. Returns an empty slice if key does not exist.

For more information about the command please refer to [SMEMBERS].

[SMEMBERS]: (https://redis.io/docs/latest/commands/smembers/)

func (Client) SMembersMap

func (c Client) SMembersMap(ctx context.Context, key string) *StringStructMapCmd

Returns all the members of the set value stored at key as a map. Returns an empty map if key does not exist.

For more information about the command please refer to [SMEMBERS].

[SMEMBERS]: (https://redis.io/docs/latest/commands/smembers/)

func (Client) SMove

func (c Client) SMove(ctx context.Context, source, destination string, member interface{}) *BoolCmd

Moves member from the set at source to the set at destination. This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients.

For more information about the command please refer to [SMOVE].

[SMOVE]: (https://redis.io/docs/latest/commands/smove/)

func (Client) SPop

func (c Client) SPop(ctx context.Context, key string) *StringCmd

Removes and returns one or more random members from the set value stored at key. This version returns a single random member.

For more information about the command please refer to [SPOP].

[SPOP]: (https://redis.io/docs/latest/commands/spop/)

func (Client) SPopN

func (c Client) SPopN(ctx context.Context, key string, count int64) *StringSliceCmd

Removes and returns one or more random members from the set value stored at key. This version returns up to count random members.

For more information about the command please refer to [SPOP].

[SPOP]: (https://redis.io/docs/latest/commands/spop/)

func (Client) SPublish

func (c Client) SPublish(ctx context.Context, channel string, message interface{}) *IntCmd

func (Client) SRandMember

func (c Client) SRandMember(ctx context.Context, key string) *StringCmd

Returns a random member from the set value stored at key. This version returns a single random member without removing it.

For more information about the command please refer to [SRANDMEMBER].

[SRANDMEMBER]: (https://redis.io/docs/latest/commands/srandmember/)

func (Client) SRandMemberN

func (c Client) SRandMemberN(ctx context.Context, key string, count int64) *StringSliceCmd

Returns an array of random members from the set value stored at key. This version returns up to count random members without removing them. When called with a positive count, returns distinct elements. When called with a negative count, allows for repeated elements.

For more information about the command please refer to [SRANDMEMBER].

[SRANDMEMBER]: (https://redis.io/docs/latest/commands/srandmember/)

func (Client) SRem

func (c Client) SRem(ctx context.Context, key string, members ...interface{}) *IntCmd

Removes the specified members from the set stored at key. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.

For more information about the command please refer to [SREM].

[SREM]: (https://redis.io/docs/latest/commands/srem/)

func (Client) SScan

func (c Client) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

Incrementally iterates the set elements stored at key. This is a cursor-based iterator that allows scanning large sets efficiently.

Parameters:

  • cursor: The cursor value for the iteration (use 0 to start a new scan)
  • match: Optional pattern to match elements (empty string means no pattern)
  • count: Optional hint about how many elements to return per iteration

For more information about the command please refer to [SSCAN].

[SSCAN]: (https://redis.io/docs/latest/commands/sscan/)

func (*Client) SSubscribe

func (c *Client) SSubscribe(ctx context.Context, channels ...string) *PubSub

SSubscribe Subscribes the client to the specified shard channels. Channels can be omitted to create empty subscription.

func (Client) SUnion

func (c Client) SUnion(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the union of all the given sets. Keys that do not exist are considered to be empty sets.

For more information about the command please refer to [SUNION].

[SUNION]: (https://redis.io/docs/latest/commands/sunion/)

func (Client) SUnionCard added in v9.22.0

func (c Client) SUnionCard(ctx context.Context, opts *SUnionCardOptions, keys ...string) *IntCmd

Returns the cardinality of the union of all the given sets. Missing keys are treated as empty sets.

For more information about the command please refer to [SUNIONCARD].

[SUNIONCARD]: (https://redis.io/docs/latest/commands/sunioncard/)

func (Client) SUnionStore

func (c Client) SUnionStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the union of all the given sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SUNIONSTORE].

[SUNIONSTORE]: (https://redis.io/docs/latest/commands/sunionstore/)

func (Client) Save

func (c Client) Save(ctx context.Context) *StatusCmd

func (Client) Scan

func (c Client) Scan(ctx context.Context, cursor uint64, match string, count int64) *ScanCmd
Example
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	rdb.FlushDB(ctx)
	for i := 0; i < 33; i++ {
		err := rdb.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()
		if err != nil {
			panic(err)
		}
	}

	var cursor uint64
	var n int
	for {
		var keys []string
		var err error
		keys, cursor, err = rdb.Scan(ctx, cursor, "key*", 10).Result()
		if err != nil {
			panic(err)
		}
		n += len(keys)
		if cursor == 0 {
			break
		}
	}

	fmt.Printf("found %d keys\n", n)
}
Output:
found 33 keys

func (Client) ScanType

func (c Client) ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) *ScanCmd
Example
package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	rdb.FlushDB(ctx)
	for i := 0; i < 33; i++ {
		err := rdb.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()
		if err != nil {
			panic(err)
		}
	}

	var cursor uint64
	var n int
	for {
		var keys []string
		var err error
		keys, cursor, err = rdb.ScanType(ctx, cursor, "key*", 10, "string").Result()
		if err != nil {
			panic(err)
		}
		n += len(keys)
		if cursor == 0 {
			break
		}
	}

	fmt.Printf("found %d keys\n", n)
}
Output:
found 33 keys
Example (HashType)

ExampleClient_ScanType_hashType uses the keyType "hash".

package main

import (
	"context"
	"fmt"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	rdb.FlushDB(ctx)
	for i := 0; i < 33; i++ {
		err := rdb.HSet(context.TODO(), fmt.Sprintf("key%d", i), "value", "foo").Err()
		if err != nil {
			panic(err)
		}
	}

	var allKeys []string
	var cursor uint64
	var err error

	for {
		var keysFromScan []string
		keysFromScan, cursor, err = rdb.ScanType(context.TODO(), cursor, "key*", 10, "hash").Result()
		if err != nil {
			panic(err)
		}
		allKeys = append(allKeys, keysFromScan...)
		if cursor == 0 {
			break
		}
	}
	fmt.Printf("%d keys ready for use", len(allKeys))
}
Output:
33 keys ready for use

func (Client) ScriptExists

func (c Client) ScriptExists(ctx context.Context, hashes ...string) *BoolSliceCmd

func (Client) ScriptFlush

func (c Client) ScriptFlush(ctx context.Context) *StatusCmd

func (Client) ScriptKill

func (c Client) ScriptKill(ctx context.Context) *StatusCmd

func (Client) ScriptLoad

func (c Client) ScriptLoad(ctx context.Context, script string) *StringCmd

func (Client) Set

func (c Client) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

Set Redis `SET key value [expiration]` command. Use expiration for `SETEx`-like behavior.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

Example
package main

import (
	"context"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	// Last argument is expiration. Zero means the key has no
	// expiration time.
	err := rdb.Set(ctx, "key", "value", 0).Err()
	if err != nil {
		panic(err)
	}

	// key2 will expire in an hour.
	err = rdb.Set(ctx, "key2", "value", time.Hour).Err()
	if err != nil {
		panic(err)
	}
}

func (Client) SetArgs

func (c Client) SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.

func (Client) SetBit

func (c Client) SetBit(ctx context.Context, key string, offset int64, value int) *IntCmd

func (Client) SetEx deprecated

func (c Client) SetEx(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

SetEx sets the value and expiration of a key.

Deprecated: Use Set with expiration instead as of Redis 2.6.12.

Example
package main

import (
	"context"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	err := rdb.SetEx(ctx, "key", "value", time.Hour).Err()
	if err != nil {
		panic(err)
	}
}

func (Client) SetFromBuffer added in v9.21.0

func (c Client) SetFromBuffer(ctx context.Context, key string, buf []byte) *StatusCmd

SetFromBuffer executes SET writing the value directly from buf. For values larger than the connection's write buffer, bufio.Writer.Write flushes its internal buffer (containing the RESP header) and then writes buf straight to the socket — effectively zero-copy on the send path.

Expiration is not supported; use Expire separately if a TTL is required.

Note: SetFromBuffer is exposed for API symmetry with GetToBuffer and is functionally equivalent to Set(ctx, key, buf, 0) — both dispatch to the same []byte case in the RESP writer and produce identical bytes on the wire. The zero-copy property on the send path comes from bufio.Writer.Write bypassing its internal buffer for large payloads, which Set([]byte) gets automatically. Prefer SetFromBuffer in code that also uses GetToBuffer so the buffer-based pattern reads coherently; otherwise Set(ctx, key, buf, 0) is equally efficient.

func (Client) SetIFDEQ added in v9.17.0

func (c Client) SetIFDEQ(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StatusCmd

SetIFDEQ sets the value only if the current value's digest equals matchDigest.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns "OK" on success. Returns redis.Nil if the digest doesn't match (value was modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFNEQ is still experimental it's signature and behaviour may change

func (Client) SetIFDEQGet added in v9.17.0

func (c Client) SetIFDEQGet(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StringCmd

SetIFDEQGet sets the value only if the current value's digest equals matchDigest, and returns the previous value.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns the previous value on success. Returns redis.Nil if the digest doesn't match (value was modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFNEQGet is still experimental it's signature and behaviour may change

func (Client) SetIFDNE added in v9.17.0

func (c Client) SetIFDNE(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StatusCmd

SetIFDNE sets the value only if the current value's digest does NOT equal matchDigest.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns "OK" on success (digest didn't match, value was set). Returns redis.Nil if the digest matches (value was not modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFDNE is still experimental it's signature and behaviour may change

func (Client) SetIFDNEGet added in v9.17.0

func (c Client) SetIFDNEGet(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StringCmd

SetIFDNEGet sets the value only if the current value's digest does NOT equal matchDigest, and returns the previous value.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns the previous value on success (digest didn't match, value was set). Returns redis.Nil if the digest matches (value was not modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFDNEGet is still experimental it's signature and behaviour may change

func (Client) SetIFEQ added in v9.17.0

func (c Client) SetIFEQ(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd

SetIFEQ Redis `SET key value [expiration] IFEQ match-value` command. Compare-and-set: only sets the value if the current value equals matchValue.

Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFEQ is still experimental it's signature and behaviour may change

func (Client) SetIFEQGet added in v9.17.0

func (c Client) SetIFEQGet(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StringCmd

SetIFEQGet Redis `SET key value [expiration] IFEQ match-value GET` command. Compare-and-set with GET: only sets the value if the current value equals matchValue, and returns the previous value.

Returns the previous value on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFEQGet is still experimental it's signature and behaviour may change

func (Client) SetIFNE added in v9.17.0

func (c Client) SetIFNE(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd

SetIFNE Redis `SET key value [expiration] IFNE match-value` command. Compare-and-set: only sets the value if the current value does not equal matchValue.

Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFNE is still experimental it's signature and behaviour may change

func (Client) SetIFNEGet added in v9.17.0

func (c Client) SetIFNEGet(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StringCmd

SetIFNEGet Redis `SET key value [expiration] IFNE match-value GET` command. Compare-and-set with GET: only sets the value if the current value does not equal matchValue, and returns the previous value.

Returns the previous value on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFNEGet is still experimental it's signature and behaviour may change

func (Client) SetNX

func (c Client) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd

SetNX sets the value of a key only if the key does not exist.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (Client) SetRange

func (c Client) SetRange(ctx context.Context, key string, offset int64, value string) *IntCmd

func (Client) SetXX

func (c Client) SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd

SetXX Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (Client) Shutdown

func (c Client) Shutdown(ctx context.Context) *StatusCmd

func (Client) ShutdownNoSave

func (c Client) ShutdownNoSave(ctx context.Context) *StatusCmd

func (Client) ShutdownSave

func (c Client) ShutdownSave(ctx context.Context) *StatusCmd

func (Client) SlaveOf deprecated

func (c Client) SlaveOf(ctx context.Context, host, port string) *StatusCmd

SlaveOf sets a Redis server as a replica of another, or promotes it to being a master.

Deprecated: Use ReplicaOf instead as of Redis 5.0.0.

func (Client) SlowLogGet

func (c Client) SlowLogGet(ctx context.Context, num int64) *SlowLogCmd
Example
if RECluster {
	// skip slowlog test for cluster
	fmt.Println(2)
	return
}
const key = "slowlog-log-slower-than"

old := rdb.ConfigGet(ctx, key).Val()
rdb.ConfigSet(ctx, key, "0")
defer rdb.ConfigSet(ctx, key, old[key])

if err := rdb.Do(ctx, "slowlog", "reset").Err(); err != nil {
	panic(err)
}

rdb.Set(ctx, "test", "true", 0)

result, err := rdb.SlowLogGet(ctx, -1).Result()
if err != nil {
	panic(err)
}
fmt.Println(len(result))
Output:
2

func (Client) SlowLogLen added in v9.17.0

func (c Client) SlowLogLen(ctx context.Context) *IntCmd

func (Client) SlowLogReset added in v9.17.0

func (c Client) SlowLogReset(ctx context.Context) *StatusCmd

func (Client) Sort

func (c Client) Sort(ctx context.Context, key string, sort *Sort) *StringSliceCmd

func (Client) SortInterfaces

func (c Client) SortInterfaces(ctx context.Context, key string, sort *Sort) *SliceCmd

func (Client) SortRO

func (c Client) SortRO(ctx context.Context, key string, sort *Sort) *StringSliceCmd

func (Client) SortStore

func (c Client) SortStore(ctx context.Context, key, store string, sort *Sort) *IntCmd

func (Client) StrLen

func (c Client) StrLen(ctx context.Context, key string) *IntCmd

func (Client) String

func (c Client) String() string

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, channels ...string) *PubSub

Subscribe subscribes the client to the specified channels. Channels can be omitted to create empty subscription. Note that this method does not wait on a response from Redis, so the subscription may not be active immediately. To force the connection to wait, you may call the Receive() method on the returned *PubSub like so:

sub := client.Subscribe(queryResp)
iface, err := sub.Receive()
if err != nil {
    // handle error
}

// Should be *Subscription, but others are possible if other actions have been
// taken on sub since it was created.
switch iface.(type) {
case *Subscription:
    // subscribe succeeded
case *Message:
    // received first message
case *Pong:
    // pong received
default:
    // handle error
}

ch := sub.Channel()

func (Client) Sync

func (c Client) Sync(_ context.Context)

func (Client) TDigestAdd added in v9.1.0

func (c Client) TDigestAdd(ctx context.Context, key string, elements ...float64) *StatusCmd

TDigestAdd adds one or more elements to a t-Digest data structure. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.add/

func (Client) TDigestByRank added in v9.1.0

func (c Client) TDigestByRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd

TDigestByRank returns an array of values from a t-Digest data structure based on their rank. The rank of an element is its position in the sorted list of all elements in the t-Digest. Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.byrank/

func (Client) TDigestByRevRank added in v9.1.0

func (c Client) TDigestByRevRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd

TDigestByRevRank returns an array of values from a t-Digest data structure based on their reverse rank. The reverse rank of an element is its position in the sorted list of all elements in the t-Digest when sorted in descending order. Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.byrevrank/

func (Client) TDigestCDF added in v9.1.0

func (c Client) TDigestCDF(ctx context.Context, key string, elements ...float64) *FloatSliceCmd

TDigestCDF returns an array of cumulative distribution function (CDF) values for one or more elements in a t-Digest data structure. The CDF value for an element is the fraction of all elements in the t-Digest that are less than or equal to it. Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.cdf/

func (Client) TDigestCreate added in v9.1.0

func (c Client) TDigestCreate(ctx context.Context, key string) *StatusCmd

TDigestCreate creates an empty t-Digest data structure with default parameters. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.create/

func (Client) TDigestCreateWithCompression added in v9.1.0

func (c Client) TDigestCreateWithCompression(ctx context.Context, key string, compression int64) *StatusCmd

TDigestCreateWithCompression creates an empty t-Digest data structure with a specified compression parameter. The compression parameter controls the accuracy and memory usage of the t-Digest. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.create/

func (Client) TDigestInfo added in v9.1.0

func (c Client) TDigestInfo(ctx context.Context, key string) *TDigestInfoCmd

TDigestInfo returns information about a t-Digest data structure. For more information - https://redis.io/commands/tdigest.info/

func (Client) TDigestMax added in v9.1.0

func (c Client) TDigestMax(ctx context.Context, key string) *FloatCmd

TDigestMax returns the maximum value from a t-Digest data structure. For more information - https://redis.io/commands/tdigest.max/

func (Client) TDigestMerge added in v9.1.0

func (c Client) TDigestMerge(ctx context.Context, destKey string, options *TDigestMergeOptions, sourceKeys ...string) *StatusCmd

TDigestMerge merges multiple t-Digest data structures into a single t-Digest. This function also allows for specifying additional options such as compression and override behavior. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.merge/

func (Client) TDigestMin added in v9.1.0

func (c Client) TDigestMin(ctx context.Context, key string) *FloatCmd

TDigestMin returns the minimum value from a t-Digest data structure. For more information - https://redis.io/commands/tdigest.min/

func (Client) TDigestQuantile added in v9.1.0

func (c Client) TDigestQuantile(ctx context.Context, key string, elements ...float64) *FloatSliceCmd

TDigestQuantile returns an array of quantile values for one or more elements in a t-Digest data structure. The quantile value for an element is the fraction of all elements in the t-Digest that are less than or equal to it. Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.quantile/

func (Client) TDigestRank added in v9.1.0

func (c Client) TDigestRank(ctx context.Context, key string, values ...float64) *IntSliceCmd

TDigestRank returns an array of rank values for one or more elements in a t-Digest data structure. The rank of an element is its position in the sorted list of all elements in the t-Digest. Returns an array of integers representing the rank values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.rank/

func (Client) TDigestReset added in v9.1.0

func (c Client) TDigestReset(ctx context.Context, key string) *StatusCmd

TDigestReset resets a t-Digest data structure to its initial state. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.reset/

func (Client) TDigestRevRank added in v9.1.0

func (c Client) TDigestRevRank(ctx context.Context, key string, values ...float64) *IntSliceCmd

TDigestRevRank returns an array of reverse rank values for one or more elements in a t-Digest data structure. The reverse rank of an element is its position in the sorted list of all elements in the t-Digest when sorted in descending order. Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.revrank/

func (Client) TDigestTrimmedMean added in v9.1.0

func (c Client) TDigestTrimmedMean(ctx context.Context, key string, lowCutQuantile, highCutQuantile float64) *FloatCmd

TDigestTrimmedMean returns the trimmed mean value from a t-Digest data structure. The trimmed mean is calculated by removing a specified fraction of the highest and lowest values from the t-Digest and then calculating the mean of the remaining values. Returns a float representing the trimmed mean value or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.trimmed_mean/

func (Client) TSAdd added in v9.2.0

func (c Client) TSAdd(ctx context.Context, key string, timestamp interface{}, value float64) *IntCmd

TSAdd - Adds one or more observations to a t-digest sketch. For more information - https://redis.io/commands/ts.add/

func (Client) TSAddWithArgs added in v9.2.0

func (c Client) TSAddWithArgs(ctx context.Context, key string, timestamp interface{}, value float64, options *TSOptions) *IntCmd

TSAddWithArgs - Adds one or more observations to a t-digest sketch. This function also allows for specifying additional options such as: Retention, ChunkSize, Encoding, DuplicatePolicy and Labels. For more information - https://redis.io/commands/ts.add/

func (Client) TSAlter added in v9.2.0

func (c Client) TSAlter(ctx context.Context, key string, options *TSAlterOptions) *StatusCmd

TSAlter - Alters an existing time-series key with additional options. This function allows for specifying additional options such as: Retention, ChunkSize and DuplicatePolicy. For more information - https://redis.io/commands/ts.alter/

func (Client) TSCreate added in v9.2.0

func (c Client) TSCreate(ctx context.Context, key string) *StatusCmd

TSCreate - Creates a new time-series key. For more information - https://redis.io/commands/ts.create/

func (Client) TSCreateRule added in v9.2.0

func (c Client) TSCreateRule(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd

TSCreateRule - Creates a compaction rule from sourceKey to destKey. For more information - https://redis.io/commands/ts.createrule/

func (Client) TSCreateRuleWithArgs added in v9.2.0

func (c Client) TSCreateRuleWithArgs(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd

TSCreateRuleWithArgs - Creates a compaction rule from sourceKey to destKey with additional option. This function allows for specifying additional option such as: alignTimestamp. For more information - https://redis.io/commands/ts.createrule/

func (Client) TSCreateWithArgs added in v9.2.0

func (c Client) TSCreateWithArgs(ctx context.Context, key string, options *TSOptions) *StatusCmd

TSCreateWithArgs - Creates a new time-series key with additional options. This function allows for specifying additional options such as: Retention, ChunkSize, Encoding, DuplicatePolicy and Labels. For more information - https://redis.io/commands/ts.create/

func (Client) TSDecrBy added in v9.2.0

func (c Client) TSDecrBy(ctx context.Context, Key string, timestamp float64) *IntCmd

TSDecrBy - Decrements the value of a time-series key by the specified timestamp. For more information - https://redis.io/commands/ts.decrby/

func (Client) TSDecrByWithArgs added in v9.2.0

func (c Client) TSDecrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd

TSDecrByWithArgs - Decrements the value of a time-series key by the specified timestamp with additional options. This function allows for specifying additional options such as: Timestamp, Retention, ChunkSize, Uncompressed and Labels. For more information - https://redis.io/commands/ts.decrby/

func (Client) TSDel added in v9.2.0

func (c Client) TSDel(ctx context.Context, Key string, fromTimestamp int, toTimestamp int) *IntCmd

TSDel - Deletes a range of samples from a time-series key. For more information - https://redis.io/commands/ts.del/

func (Client) TSDeleteRule added in v9.2.0

func (c Client) TSDeleteRule(ctx context.Context, sourceKey string, destKey string) *StatusCmd

TSDeleteRule - Deletes a compaction rule from sourceKey to destKey. For more information - https://redis.io/commands/ts.deleterule/

func (Client) TSGet added in v9.2.0

func (c Client) TSGet(ctx context.Context, key string) *TSTimestampValueCmd

TSGet - Gets the last sample of a time-series key. For more information - https://redis.io/commands/ts.get/

func (Client) TSGetWithArgs added in v9.2.0

func (c Client) TSGetWithArgs(ctx context.Context, key string, options *TSGetOptions) *TSTimestampValueCmd

TSGetWithArgs - Gets the last sample of a time-series key with additional option. This function allows for specifying additional option such as: Latest. For more information - https://redis.io/commands/ts.get/

func (Client) TSIncrBy added in v9.2.0

func (c Client) TSIncrBy(ctx context.Context, Key string, timestamp float64) *IntCmd

TSIncrBy - Increments the value of a time-series key by the specified timestamp. For more information - https://redis.io/commands/ts.incrby/

func (Client) TSIncrByWithArgs added in v9.2.0

func (c Client) TSIncrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd

TSIncrByWithArgs - Increments the value of a time-series key by the specified timestamp with additional options. This function allows for specifying additional options such as: Timestamp, Retention, ChunkSize, Uncompressed and Labels. For more information - https://redis.io/commands/ts.incrby/

func (Client) TSInfo added in v9.2.0

func (c Client) TSInfo(ctx context.Context, key string) *MapStringInterfaceCmd

TSInfo - Returns information about a time-series key. For more information - https://redis.io/commands/ts.info/

func (Client) TSInfoWithArgs added in v9.2.0

func (c Client) TSInfoWithArgs(ctx context.Context, key string, options *TSInfoOptions) *MapStringInterfaceCmd

TSInfoWithArgs - Returns information about a time-series key with additional option. This function allows for specifying additional option such as: Debug. For more information - https://redis.io/commands/ts.info/

func (Client) TSMAdd added in v9.2.0

func (c Client) TSMAdd(ctx context.Context, ktvSlices [][]interface{}) *IntSliceCmd

TSMAdd - Adds multiple samples to multiple time-series keys. It accepts a slice of 'ktv' slices, each containing exactly three elements: key, timestamp, and value. This struct must be provided for this command to work. For more information - https://redis.io/commands/ts.madd/

func (Client) TSMGet added in v9.2.0

func (c Client) TSMGet(ctx context.Context, filters []string) *MapStringSliceInterfaceCmd

TSMGet - Returns the last sample of multiple time-series keys. For more information - https://redis.io/commands/ts.mget/

func (Client) TSMGetWithArgs added in v9.2.0

func (c Client) TSMGetWithArgs(ctx context.Context, filters []string, options *TSMGetOptions) *MapStringSliceInterfaceCmd

TSMGetWithArgs - Returns the last sample of multiple time-series keys with additional options. This function allows for specifying additional options such as: Latest, WithLabels and SelectedLabels. For more information - https://redis.io/commands/ts.mget/

func (Client) TSMRange added in v9.2.0

func (c Client) TSMRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd

TSMRange - Returns a range of samples from multiple time-series keys. For more information - https://redis.io/commands/ts.mrange/

func (Client) TSMRangeWithArgs added in v9.2.0

func (c Client) TSMRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd

TSMRangeWithArgs - Returns a range of samples from multiple time-series keys. Options are set via TSMRangeOptions. For more information - https://redis.io/commands/ts.mrange/

func (Client) TSMRevRange added in v9.2.0

func (c Client) TSMRevRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd

TSMRevRange - Returns a range of samples from multiple time-series keys in reverse order. For more information - https://redis.io/commands/ts.mrevrange/

func (Client) TSMRevRangeWithArgs added in v9.2.0

func (c Client) TSMRevRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd

TSMRevRangeWithArgs - Returns a range of samples from multiple time-series keys in reverse order. Options are set via TSMRevRangeOptions. For more information - https://redis.io/commands/ts.mrevrange/

func (Client) TSNRange added in v9.22.0

func (c Client) TSNRange(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}) *TSNRangePivotRowSliceCmd

TSNRange - Queries multiple time-series keys and returns a pivot response in forward (ascending) order. For more information - https://redis.io/commands/ts.nrange/

func (Client) TSNRangeWithArgs added in v9.22.0

func (c Client) TSNRangeWithArgs(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}, options *TSNRangeOptions) *TSNRangePivotRowSliceCmd

TSNRangeWithArgs - Queries multiple time-series keys and returns a pivot response in forward (ascending) order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregators, BucketDuration, BucketTimestamp and Empty. Aggregators must contain exactly one spec per key; each spec lists one or more aggregators for its key and is emitted as a single comma-joined wire token. For more information - https://redis.io/commands/ts.nrange/

func (Client) TSNRevRange added in v9.22.0

func (c Client) TSNRevRange(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}) *TSNRangePivotRowSliceCmd

TSNRevRange - Queries multiple time-series keys and returns a pivot response in reverse (descending) order. For more information - https://redis.io/commands/ts.nrevrange/

func (Client) TSNRevRangeWithArgs added in v9.22.0

func (c Client) TSNRevRangeWithArgs(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}, options *TSNRevRangeOptions) *TSNRangePivotRowSliceCmd

TSNRevRangeWithArgs - Queries multiple time-series keys and returns a pivot response in reverse (descending) order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregators, BucketDuration, BucketTimestamp and Empty. Aggregators must contain exactly one spec per key; each spec lists one or more aggregators for its key and is emitted as a single comma-joined wire token. For more information - https://redis.io/commands/ts.nrevrange/

func (Client) TSQueryIndex added in v9.2.0

func (c Client) TSQueryIndex(ctx context.Context, filterExpr []string) *StringSliceCmd

TSQueryIndex - Returns all the keys matching the filter expression. For more information - https://redis.io/commands/ts.queryindex/

func (Client) TSQueryLabelValues added in v9.22.0

func (c Client) TSQueryLabelValues(ctx context.Context, label string, filterExpr []string) *StringSliceCmd

TSQueryLabelValues - Returns the set of values assigned to the given label name across the time series matching the filter expressions. Passing no filter expressions queries all indexed series. The label name is matched byte-exactly; a label present on no matching series yields an empty reply, not an error. The reply is unordered and already deduplicated by the server. filterExpr uses the same filter language as TSQueryIndex and is passed to the server verbatim. Available since Redis 8.10. For more information - https://redis.io/commands/ts.querylabels/

func (Client) TSQueryLabels added in v9.22.0

func (c Client) TSQueryLabels(ctx context.Context, filterExpr []string) *StringSliceCmd

TSQueryLabels - Returns the set of label names present on the time series matching the filter expressions. Passing no filter expressions queries all indexed series. The reply is unordered and already deduplicated by the server; it includes the label names used in the filter itself, and an empty reply is a valid result, not an error. filterExpr uses the same filter language as TSQueryIndex and is passed to the server verbatim. Available since Redis 8.10. For more information - https://redis.io/commands/ts.querylabels/

func (Client) TSRange added in v9.2.0

func (c Client) TSRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd

TSRange - Returns a range of samples from a time-series key. For more information - https://redis.io/commands/ts.range/

func (Client) TSRangeWithArgs added in v9.2.0

func (c Client) TSRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRangeOptions) *TSTimestampValueSliceCmd

TSRangeWithArgs - Returns a range of samples from a time-series key with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregator, BucketDuration, BucketTimestamp and Empty. For more information - https://redis.io/commands/ts.range/

func (Client) TSRead added in v9.22.0

func (c Client) TSRead(ctx context.Context, key string, timestamp interface{}) *TSTimestampValueSliceCmd

TSRead - Returns samples at or after timestamp, in ascending order. timestamp is a non-negative Unix-ms integer or a sentinel (TSReadEarliest, TSReadLatest, TSReadNew). For more information - https://redis.io/commands/ts.read/

func (Client) TSReadWithArgs added in v9.22.0

func (c Client) TSReadWithArgs(ctx context.Context, key string, timestamp interface{}, options *TSReadOptions) *TSTimestampValueSliceCmd

TSReadWithArgs - TS.READ with the optional BLOCK and MAX_COUNT groups. When options.Block is set it waits for options.MinCount samples or until options.Timeout elapses. Blocking calls must not be used in a pipeline or MULTI. For more information - https://redis.io/commands/ts.read/

func (Client) TSRevRange added in v9.2.0

func (c Client) TSRevRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd

TSRevRange - Returns a range of samples from a time-series key in reverse order. For more information - https://redis.io/commands/ts.revrange/

func (Client) TSRevRangeWithArgs added in v9.2.0

func (c Client) TSRevRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRevRangeOptions) *TSTimestampValueSliceCmd

TSRevRangeWithArgs - Returns a range of samples from a time-series key in reverse order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregator, BucketDuration, BucketTimestamp and Empty. For more information - https://redis.io/commands/ts.revrange/

func (Client) TTL

func (c Client) TTL(ctx context.Context, key string) *DurationCmd

func (Client) Time

func (c Client) Time(ctx context.Context) *TimeCmd

func (Client) TopKAdd added in v9.1.0

func (c Client) TopKAdd(ctx context.Context, key string, elements ...interface{}) *StringSliceCmd

TopKAdd adds one or more elements to a Top-K filter. Returns an array of strings representing the items that were removed from the filter, if any. For more information - https://redis.io/commands/topk.add/

func (Client) TopKCount added in v9.1.0

func (c Client) TopKCount(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

TopKCount returns an estimate of the number of times an item may be in a Top-K filter. For more information - https://redis.io/commands/topk.count/

func (Client) TopKIncrBy added in v9.1.0

func (c Client) TopKIncrBy(ctx context.Context, key string, elements ...interface{}) *StringSliceCmd

TopKIncrBy increases the count of one or more items in a Top-K filter. For more information - https://redis.io/commands/topk.incrby/

func (Client) TopKInfo added in v9.1.0

func (c Client) TopKInfo(ctx context.Context, key string) *TopKInfoCmd

TopKInfo returns information about a Top-K filter. For more information - https://redis.io/commands/topk.info/

func (Client) TopKList added in v9.1.0

func (c Client) TopKList(ctx context.Context, key string) *StringSliceCmd

TopKList returns all items in Top-K list. For more information - https://redis.io/commands/topk.list/

func (Client) TopKListWithCount added in v9.1.0

func (c Client) TopKListWithCount(ctx context.Context, key string) *MapStringIntCmd

TopKListWithCount returns all items in Top-K list with their respective count. For more information - https://redis.io/commands/topk.list/

func (Client) TopKQuery added in v9.1.0

func (c Client) TopKQuery(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

TopKQuery check if multiple elements exist in a Top-K filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/topk.query/

func (Client) TopKReserve added in v9.1.0

func (c Client) TopKReserve(ctx context.Context, key string, k int64) *StatusCmd

TopKReserve creates an empty Top-K filter with the specified number of top items to keep. For more information - https://redis.io/commands/topk.reserve/

func (Client) TopKReserveWithOptions added in v9.1.0

func (c Client) TopKReserveWithOptions(ctx context.Context, key string, k int64, width, depth int64, decay float64) *StatusCmd

TopKReserveWithOptions creates an empty Top-K filter with the specified number of top items to keep and additional options. This function allows for specifying additional options such as width, depth and decay. For more information - https://redis.io/commands/topk.reserve/

func (Client) Touch

func (c Client) Touch(ctx context.Context, keys ...string) *IntCmd

func (*Client) TxPipeline

func (c *Client) TxPipeline() Pipeliner

TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.

Example
package main

import (
	"context"
	"fmt"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	pipe := rdb.TxPipeline()

	incr := pipe.Incr(ctx, "tx_pipeline_counter")
	pipe.Expire(ctx, "tx_pipeline_counter", time.Hour)

	// Execute
	//
	//     MULTI
	//     INCR pipeline_counter
	//     EXPIRE pipeline_counts 3600
	//     EXEC
	//
	// using one rdb-server roundtrip.
	_, err := pipe.Exec(ctx)
	fmt.Println(incr.Val(), err)
}
Output:
1 <nil>

func (*Client) TxPipelined

func (c *Client) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
Example
package main

import (
	"context"
	"fmt"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func main() {
	var incr *redis.IntCmd
	_, err := rdb.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
		incr = pipe.Incr(ctx, "tx_pipelined_counter")
		pipe.Expire(ctx, "tx_pipelined_counter", time.Hour)
		return nil
	})
	fmt.Println(incr.Val(), err)
}
Output:
1 <nil>

func (Client) Type

func (c Client) Type(ctx context.Context, key string) *StatusCmd
func (c Client) Unlink(ctx context.Context, keys ...string) *IntCmd

func (Client) VAdd added in v9.10.0

func (c Client) VAdd(ctx context.Context, key, element string, val Vector) *BoolCmd

`VADD key (FP32 | VALUES num) vector element` note: the API is experimental and may be subject to change.

func (Client) VAddWithArgs added in v9.10.0

func (c Client) VAddWithArgs(ctx context.Context, key, element string, val Vector, addArgs *VAddArgs) *BoolCmd

`VADD key [REDUCE dim] (FP32 | VALUES num) vector element [CAS] [NOQUANT | Q8 | BIN] [EF build-exploration-factor] [SETATTR attributes] [M numlinks]` note: the API is experimental and may be subject to change.

func (Client) VCard added in v9.10.0

func (c Client) VCard(ctx context.Context, key string) *IntCmd

`VCARD key` note: the API is experimental and may be subject to change.

func (Client) VClearAttributes added in v9.10.0

func (c Client) VClearAttributes(ctx context.Context, key, element string) *BoolCmd

`VClearAttributes` clear attributes on a vector set element. The implementation of `VClearAttributes` is execute command `VSETATTR key element ""`. note: the API is experimental and may be subject to change.

func (Client) VDim added in v9.10.0

func (c Client) VDim(ctx context.Context, key string) *IntCmd

`VDIM key` note: the API is experimental and may be subject to change.

func (Client) VEmb added in v9.10.0

func (c Client) VEmb(ctx context.Context, key, element string, raw bool) *SliceCmd

`VEMB key element [RAW]` note: the API is experimental and may be subject to change.

func (Client) VGetAttr added in v9.10.0

func (c Client) VGetAttr(ctx context.Context, key, element string) *StringCmd

`VGETATTR key element` note: the API is experimental and may be subject to change.

func (Client) VInfo added in v9.10.0

func (c Client) VInfo(ctx context.Context, key string) *MapStringInterfaceCmd

`VINFO key` note: the API is experimental and may be subject to change.

func (Client) VIsMember added in v9.19.0

func (c Client) VIsMember(ctx context.Context, key, element string) *BoolCmd

`VISMEMBER key element` Check if an element exists in a vector set. note: the API is experimental and may be subject to change.

func (c Client) VLinks(ctx context.Context, key, element string) *StringSliceSliceCmd

`VLINKS key element` note: the API is experimental and may be subject to change.

func (Client) VLinksWithScores added in v9.10.0

func (c Client) VLinksWithScores(ctx context.Context, key, element string) *VectorScoreSliceSliceCmd

`VLINKS key element WITHSCORES` note: the API is experimental and may be subject to change.

func (Client) VRandMember added in v9.10.0

func (c Client) VRandMember(ctx context.Context, key string) *StringCmd

`VRANDMEMBER key` note: the API is experimental and may be subject to change.

func (Client) VRandMemberCount added in v9.10.0

func (c Client) VRandMemberCount(ctx context.Context, key string, count int) *StringSliceCmd

`VRANDMEMBER key [count]` note: the API is experimental and may be subject to change.

func (Client) VRange added in v9.17.0

func (c Client) VRange(ctx context.Context, key, start, end string, count int64) *StringSliceCmd

`VRANGE key start end count` a negative count means to return all the elements in the vector set. note: the API is experimental and may be subject to change.

func (Client) VRem added in v9.10.0

func (c Client) VRem(ctx context.Context, key, element string) *BoolCmd

`VREM key element` note: the API is experimental and may be subject to change.

func (Client) VSetAttr added in v9.10.0

func (c Client) VSetAttr(ctx context.Context, key, element string, attr interface{}) *BoolCmd

`VSETATTR key element "{ JSON obj }"` The `attr` must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON.

note: the API is experimental and may be subject to change.

func (Client) VSim added in v9.10.0

func (c Client) VSim(ctx context.Context, key string, val Vector) *StringSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element)` note: the API is experimental and may be subject to change.

func (Client) VSimWithArgs added in v9.10.0

func (c Client) VSimWithArgs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *StringSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` note: the API is experimental and may be subject to change.

func (Client) VSimWithArgsWithAttribs added in v9.19.0

func (c Client) VSimWithArgsWithAttribs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorAttribSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHATTRIBS] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` WITHATTRIBS is only available in Redis v8.2.0+ note: the API is experimental and may be subject to change.

func (Client) VSimWithArgsWithScores added in v9.10.0

func (c Client) VSimWithArgsWithScores(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorScoreSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` note: the API is experimental and may be subject to change.

func (Client) VSimWithArgsWithScoresWithAttribs added in v9.19.0

func (c Client) VSimWithArgsWithScoresWithAttribs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorScoreAttribSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [WITHATTRIBS] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` WITHATTRIBS is only available in Redis v8.2.0+ note: the API is experimental and may be subject to change.

func (Client) VSimWithScores added in v9.10.0

func (c Client) VSimWithScores(ctx context.Context, key string, val Vector) *VectorScoreSliceCmd

`VSIM key (ELE | FP32 | VALUES num) (vector | element) WITHSCORES` note: the API is experimental and may be subject to change.

func (Client) Wait

func (c Client) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd

func (Client) WaitAOF added in v9.2.0

func (c Client) WaitAOF(ctx context.Context, numLocal, numSlaves int, timeout time.Duration) *IntSliceCmd

func (*Client) Watch

func (c *Client) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error

Watch prepares a transaction and marks the keys to be watched for conditional execution if there are any keys.

The transaction is automatically closed when fn exits.

Example
package main

import (
	"context"
	"errors"
	"fmt"
	"sync"
	"time"

	"github.com/redis/go-redis/v9"
)

var (
	ctx = context.Background()
	rdb *redis.Client
)

func init() {
	rdb = redis.NewClient(&redis.Options{
		Addr:         ":6379",
		DialTimeout:  10 * time.Second,
		ReadTimeout:  30 * time.Second,
		WriteTimeout: 30 * time.Second,
		PoolSize:     10,
		PoolTimeout:  30 * time.Second,
	})
}

func main() {
	const maxRetries = 10000

	// Increment transactionally increments key using GET and SET commands.
	increment := func(key string) error {
		// Transactional function.
		txf := func(tx *redis.Tx) error {
			// Get current value or zero.
			n, err := tx.Get(ctx, key).Int()
			if err != nil && err != redis.Nil {
				return err
			}

			// Actual operation (local in optimistic lock).
			n++

			// Operation is committed only if the watched keys remain unchanged.
			_, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
				pipe.Set(ctx, key, n, 0)
				return nil
			})
			return err
		}

		for i := 0; i < maxRetries; i++ {
			err := rdb.Watch(ctx, txf, key)
			if err == nil {
				// Success.
				return nil
			}
			if err == redis.TxFailedErr {
				// Optimistic lock lost. Retry.
				continue
			}
			// Return any other error.
			return err
		}

		return errors.New("increment reached maximum number of retries")
	}

	var wg sync.WaitGroup
	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()

			if err := increment("counter3"); err != nil {
				fmt.Println("increment error:", err)
			}
		}()
	}
	wg.Wait()

	n, err := rdb.Get(ctx, "counter3").Int()
	fmt.Println("ended with", n, err)
}
Output:
ended with 100 <nil>
Example (Instrumentation)
rdb := redis.NewClient(&redis.Options{
	Addr:            ":6379",
	DisableIdentity: true,
})
rdb.AddHook(redisHook{})

rdb.Watch(ctx, func(tx *redis.Tx) error {
	tx.Ping(ctx)
	tx.Ping(ctx)
	return nil
}, "foo")
Output:
starting processing: <[watch foo]>
dialing tcp :6379
finished dialing tcp :6379
starting processing: <[hello 3]>
finished processing: <[hello 3]>
starting processing: <[client maint_notifications on moving-endpoint-type internal-ip]>
finished processing: <[client maint_notifications on moving-endpoint-type internal-ip]>
finished processing: <[watch foo]>
starting processing: <[ping]>
finished processing: <[ping]>
starting processing: <[ping]>
finished processing: <[ping]>
starting processing: <[unwatch]>
finished processing: <[unwatch]>

func (*Client) WithTimeout

func (c *Client) WithTimeout(timeout time.Duration) *Client

WithTimeout returns a clone sharing the parent's connection pools with the given read/write timeout. The clone caches its own autopipeliners, separate from the parent's: an AutoPipeline()/AsyncAutoPipeline() created on the clone registers a close hook on the shared pool. Closing any pool-sharing wrapper (the parent or another clone) drains and stops every registered engine's background flusher before the shared pools are torn down, so no flusher outlives the pool. That shared-pool drain does not mark the clone's autopipeliner closed, so an explicit Close on the clone still fully tears it (and its autopipeliners) down; Close is idempotent.

func (Client) XAck

func (c Client) XAck(ctx context.Context, stream, group string, ids ...string) *IntCmd

func (Client) XAckDel added in v9.12.0

func (c Client) XAckDel(ctx context.Context, stream string, group string, mode string, ids ...string) *SliceCmd

func (Client) XAdd

func (c Client) XAdd(ctx context.Context, a *XAddArgs) *StringCmd

func (Client) XAutoClaim

func (c Client) XAutoClaim(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (Client) XAutoClaimJustID

func (c Client) XAutoClaimJustID(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (Client) XAutoClaimWithDeleted added in v9.20.0

func (c Client) XAutoClaimWithDeleted(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimWithDeletedCmd

func (Client) XCfgSet added in v9.18.0

func (c Client) XCfgSet(ctx context.Context, a *XCfgSetArgs) *StatusCmd

XCfgSet sets the idempotent production configuration for a stream. XCFGSET key [IDMP-DURATION duration] [IDMP-MAXSIZE maxsize]

func (Client) XClaim

func (c Client) XClaim(ctx context.Context, a *XClaimArgs) *XMessageSliceCmd

func (Client) XClaimJustID

func (c Client) XClaimJustID(ctx context.Context, a *XClaimArgs) *StringSliceCmd

func (Client) XDel

func (c Client) XDel(ctx context.Context, stream string, ids ...string) *IntCmd

func (Client) XDelEx added in v9.12.0

func (c Client) XDelEx(ctx context.Context, stream string, mode string, ids ...string) *SliceCmd

func (Client) XGroupCreate

func (c Client) XGroupCreate(ctx context.Context, stream, group, start string) *StatusCmd

func (Client) XGroupCreateConsumer

func (c Client) XGroupCreateConsumer(ctx context.Context, stream, group, consumer string) *IntCmd

func (Client) XGroupCreateMkStream

func (c Client) XGroupCreateMkStream(ctx context.Context, stream, group, start string) *StatusCmd

func (Client) XGroupDelConsumer

func (c Client) XGroupDelConsumer(ctx context.Context, stream, group, consumer string) *IntCmd

func (Client) XGroupDestroy

func (c Client) XGroupDestroy(ctx context.Context, stream, group string) *IntCmd

func (Client) XGroupSetID

func (c Client) XGroupSetID(ctx context.Context, stream, group, start string) *StatusCmd

func (Client) XInfoConsumers

func (c Client) XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd

func (Client) XInfoGroups

func (c Client) XInfoGroups(ctx context.Context, key string) *XInfoGroupsCmd

func (Client) XInfoStream

func (c Client) XInfoStream(ctx context.Context, key string) *XInfoStreamCmd

func (Client) XInfoStreamFull

func (c Client) XInfoStreamFull(ctx context.Context, key string, count int) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.

func (Client) XLen

func (c Client) XLen(ctx context.Context, stream string) *IntCmd

func (Client) XNack added in v9.20.0

func (c Client) XNack(ctx context.Context, a *XNackArgs) *IntCmd

XNack executes the XNACK command. See XNackArgs for the full argument documentation. Requires Redis >= 8.8.

func (Client) XPending

func (c Client) XPending(ctx context.Context, stream, group string) *XPendingCmd

func (Client) XPendingExt

func (c Client) XPendingExt(ctx context.Context, a *XPendingExtArgs) *XPendingExtCmd

func (Client) XRange

func (c Client) XRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd

func (Client) XRangeN

func (c Client) XRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd

func (Client) XRead

func (c Client) XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd

func (Client) XReadGroup

func (c Client) XReadGroup(ctx context.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (Client) XReadStreams

func (c Client) XReadStreams(ctx context.Context, streams ...string) *XStreamSliceCmd

func (Client) XRevRange

func (c Client) XRevRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd

func (Client) XRevRangeN

func (c Client) XRevRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd

func (Client) XTrimMaxLen

func (c Client) XTrimMaxLen(ctx context.Context, key string, maxLen int64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen

func (Client) XTrimMaxLenApprox

func (c Client) XTrimMaxLenApprox(ctx context.Context, key string, maxLen, limit int64) *IntCmd

XTrimMaxLenApprox trims the stream using the `~` rule. cmd: XTRIM key MAXLEN ~ maxLen [LIMIT limit]

limit == 0 omits the LIMIT clause, limit > 0 emits "LIMIT <limit>", and a negative limit (see XTrimLimitDisabled) emits "LIMIT 0" to disable the trimming effort cap.

func (Client) XTrimMaxLenApproxMode added in v9.12.0

func (c Client) XTrimMaxLenApproxMode(ctx context.Context, key string, maxLen, limit int64, mode string) *IntCmd

func (Client) XTrimMaxLenMode added in v9.12.0

func (c Client) XTrimMaxLenMode(ctx context.Context, key string, maxLen int64, mode string) *IntCmd

func (Client) XTrimMinID

func (c Client) XTrimMinID(ctx context.Context, key string, minID string) *IntCmd

func (Client) XTrimMinIDApprox

func (c Client) XTrimMinIDApprox(ctx context.Context, key string, minID string, limit int64) *IntCmd

XTrimMinIDApprox trims the stream using the `~` rule. cmd: XTRIM key MINID ~ minID [LIMIT limit]

limit == 0 omits the LIMIT clause, limit > 0 emits "LIMIT <limit>", and a negative limit (see XTrimLimitDisabled) emits "LIMIT 0" to disable the trimming effort cap.

func (Client) XTrimMinIDApproxMode added in v9.12.0

func (c Client) XTrimMinIDApproxMode(ctx context.Context, key string, minID string, limit int64, mode string) *IntCmd

func (Client) XTrimMinIDMode added in v9.12.0

func (c Client) XTrimMinIDMode(ctx context.Context, key string, minID string, mode string) *IntCmd

func (Client) ZAdd

func (c Client) ZAdd(ctx context.Context, key string, members ...Z) *IntCmd

ZAdd Redis `ZADD key score member [score member ...]` command.

func (Client) ZAddArgs

func (c Client) ZAddArgs(ctx context.Context, key string, args ZAddArgs) *IntCmd

func (Client) ZAddArgsIncr

func (c Client) ZAddArgsIncr(ctx context.Context, key string, args ZAddArgs) *FloatCmd

func (Client) ZAddGT added in v9.0.3

func (c Client) ZAddGT(ctx context.Context, key string, members ...Z) *IntCmd

ZAddGT Redis `ZADD key GT score member [score member ...]` command.

func (Client) ZAddLT added in v9.0.3

func (c Client) ZAddLT(ctx context.Context, key string, members ...Z) *IntCmd

ZAddLT Redis `ZADD key LT score member [score member ...]` command.

func (Client) ZAddNX

func (c Client) ZAddNX(ctx context.Context, key string, members ...Z) *IntCmd

ZAddNX Redis `ZADD key NX score member [score member ...]` command.

func (Client) ZAddXX

func (c Client) ZAddXX(ctx context.Context, key string, members ...Z) *IntCmd

ZAddXX Redis `ZADD key XX score member [score member ...]` command.

func (Client) ZCard

func (c Client) ZCard(ctx context.Context, key string) *IntCmd

func (Client) ZCount

func (c Client) ZCount(ctx context.Context, key, min, max string) *IntCmd

func (Client) ZDiff

func (c Client) ZDiff(ctx context.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (Client) ZDiffStore

func (c Client) ZDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (Client) ZDiffWithScores

func (c Client) ZDiffWithScores(ctx context.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (Client) ZIncrBy

func (c Client) ZIncrBy(ctx context.Context, key string, increment float64, member string) *FloatCmd

func (Client) ZInter

func (c Client) ZInter(ctx context.Context, store *ZStore) *StringSliceCmd

func (Client) ZInterCard

func (c Client) ZInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd

func (Client) ZInterStore

func (c Client) ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd

func (Client) ZInterWithScores

func (c Client) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd

func (Client) ZLexCount

func (c Client) ZLexCount(ctx context.Context, key, min, max string) *IntCmd

func (Client) ZMPop added in v9.0.3

func (c Client) ZMPop(ctx context.Context, order string, count int64, keys ...string) *ZSliceWithKeyCmd

ZMPop Pops one or more elements with the highest or lowest score from the first non-empty sorted set key from the list of provided key names. direction: "max" (highest score) or "min" (lowest score), count: > 0 example: client.ZMPop(ctx, "max", 5, "set1", "set2")

func (Client) ZMScore

func (c Client) ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd

func (Client) ZPopMax

func (c Client) ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd

func (Client) ZPopMin

func (c Client) ZPopMin(ctx context.Context, key string, count ...int64) *ZSliceCmd

func (Client) ZRandMember

func (c Client) ZRandMember(ctx context.Context, key string, count int) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (Client) ZRandMemberWithScores

func (c Client) ZRandMemberWithScores(ctx context.Context, key string, count int) *ZSliceCmd

ZRandMemberWithScores redis-server version >= 6.2.0.

func (Client) ZRange

func (c Client) ZRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

func (Client) ZRangeArgs

func (c Client) ZRangeArgs(ctx context.Context, z ZRangeArgs) *StringSliceCmd

func (Client) ZRangeArgsWithScores

func (c Client) ZRangeArgsWithScores(ctx context.Context, z ZRangeArgs) *ZSliceCmd

func (Client) ZRangeByLex deprecated

func (c Client) ZRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRangeByLex returns members in a sorted set within a lexicographical range.

Deprecated: Use ZRangeArgs with ByLex option instead as of Redis 6.2.0.

func (Client) ZRangeByScore deprecated

func (c Client) ZRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRangeByScore returns members in a sorted set within a range of scores.

Deprecated: Use ZRangeArgs with ByScore option instead as of Redis 6.2.0.

func (Client) ZRangeByScoreWithScores

func (c Client) ZRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd

func (Client) ZRangeStore

func (c Client) ZRangeStore(ctx context.Context, dst string, z ZRangeArgs) *IntCmd

func (Client) ZRangeWithScores

func (c Client) ZRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd

func (Client) ZRank

func (c Client) ZRank(ctx context.Context, key, member string) *IntCmd

func (Client) ZRankWithScore added in v9.0.4

func (c Client) ZRankWithScore(ctx context.Context, key, member string) *RankWithScoreCmd

ZRankWithScore according to the Redis documentation, if member does not exist in the sorted set or key does not exist, it will return a redis.Nil error.

func (Client) ZRem

func (c Client) ZRem(ctx context.Context, key string, members ...interface{}) *IntCmd

func (Client) ZRemRangeByLex

func (c Client) ZRemRangeByLex(ctx context.Context, key, min, max string) *IntCmd

func (Client) ZRemRangeByRank

func (c Client) ZRemRangeByRank(ctx context.Context, key string, start, stop int64) *IntCmd

func (Client) ZRemRangeByScore

func (c Client) ZRemRangeByScore(ctx context.Context, key, min, max string) *IntCmd

func (Client) ZRevRange deprecated

func (c Client) ZRevRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

ZRevRange returns members in a sorted set within a range of indexes in reverse order.

Deprecated: Use ZRangeArgs with Rev option instead as of Redis 6.2.0.

func (Client) ZRevRangeByLex deprecated

func (c Client) ZRevRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRevRangeByLex returns members in a sorted set within a lexicographical range in reverse order.

Deprecated: Use ZRangeArgs with Rev and ByLex options instead as of Redis 6.2.0.

func (Client) ZRevRangeByScore deprecated

func (c Client) ZRevRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd

ZRevRangeByScore returns members in a sorted set within a range of scores in reverse order.

Deprecated: Use ZRangeArgs with Rev and ByScore options instead as of Redis 6.2.0.

func (Client) ZRevRangeByScoreWithScores

func (c Client) ZRevRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd

func (Client) ZRevRangeWithScores

func (c Client) ZRevRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd

ZRevRangeWithScores according to the Redis documentation, if member does not exist in the sorted set or key does not exist, it will return a redis.Nil error.

func (Client) ZRevRank

func (c Client) ZRevRank(ctx context.Context, key, member string) *IntCmd

func (Client) ZRevRankWithScore added in v9.0.4

func (c Client) ZRevRankWithScore(ctx context.Context, key, member string) *RankWithScoreCmd

func (Client) ZScan

func (c Client) ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (Client) ZScore

func (c Client) ZScore(ctx context.Context, key, member string) *FloatCmd

func (Client) ZUnion

func (c Client) ZUnion(ctx context.Context, store ZStore) *StringSliceCmd

func (Client) ZUnionStore

func (c Client) ZUnionStore(ctx context.Context, dest string, store *ZStore) *IntCmd

func (Client) ZUnionWithScores

func (c Client) ZUnionWithScores(ctx context.Context, store ZStore) *ZSliceCmd

type ClientFlags added in v9.0.4

type ClientFlags uint64

ClientFlags is redis-server client flags, copy from redis/src/server.h (redis 7.0)

const (
	ClientSlave            ClientFlags = 1 << 0  /* This client is a replica */
	ClientMaster           ClientFlags = 1 << 1  /* This client is a master */
	ClientMonitor          ClientFlags = 1 << 2  /* This client is a slave monitor, see MONITOR */
	ClientMulti            ClientFlags = 1 << 3  /* This client is in a MULTI context */
	ClientBlocked          ClientFlags = 1 << 4  /* The client is waiting in a blocking operation */
	ClientDirtyCAS         ClientFlags = 1 << 5  /* Watched keys modified. EXEC will fail. */
	ClientCloseAfterReply  ClientFlags = 1 << 6  /* Close after writing entire reply. */
	ClientUnBlocked        ClientFlags = 1 << 7  /* This client was unblocked and is stored in server.unblocked_clients */
	ClientScript           ClientFlags = 1 << 8  /* This is a non-connected client used by Lua */
	ClientAsking           ClientFlags = 1 << 9  /* Client issued the ASKING command */
	ClientCloseASAP        ClientFlags = 1 << 10 /* Close this client ASAP */
	ClientUnixSocket       ClientFlags = 1 << 11 /* Client connected via Unix domain socket */
	ClientDirtyExec        ClientFlags = 1 << 12 /* EXEC will fail for errors while queueing */
	ClientMasterForceReply ClientFlags = 1 << 13 /* Queue replies even if is master */
	ClientForceAOF         ClientFlags = 1 << 14 /* Force AOF propagation of current cmd. */
	ClientForceRepl        ClientFlags = 1 << 15 /* Force replication of current cmd. */
	ClientPrePSync         ClientFlags = 1 << 16 /* Instance don't understand PSYNC. */
	ClientReadOnly         ClientFlags = 1 << 17 /* Cluster client is in read-only state. */
	ClientPubSub           ClientFlags = 1 << 18 /* Client is in Pub/Sub mode. */
	ClientPreventAOFProp   ClientFlags = 1 << 19 /* Don't propagate to AOF. */
	ClientPreventReplProp  ClientFlags = 1 << 20 /* Don't propagate to slaves. */
	ClientPreventProp      ClientFlags = ClientPreventAOFProp | ClientPreventReplProp
	ClientPendingWrite     ClientFlags = 1 << 21 /* Client has output to send but a-write handler is yet not installed. */
	ClientReplyOff         ClientFlags = 1 << 22 /* Don't send replies to client. */
	ClientReplySkipNext    ClientFlags = 1 << 23 /* Set ClientREPLY_SKIP for next cmd */
	ClientReplySkip        ClientFlags = 1 << 24 /* Don't send just this reply. */
	ClientLuaDebug         ClientFlags = 1 << 25 /* Run EVAL in debug mode. */
	ClientLuaDebugSync     ClientFlags = 1 << 26 /* EVAL debugging without fork() */
	ClientModule           ClientFlags = 1 << 27 /* Non connected client used by some module. */
	ClientProtected        ClientFlags = 1 << 28 /* Client should not be freed for now. */
	ClientExecutingCommand ClientFlags = 1 << 29 /* Indicates that the client is currently in the process of handling
	   a command. usually this will be marked only during call()
	   however, blocked clients might have this flag kept until they
	   will try to reprocess the command. */
	ClientPendingCommand      ClientFlags = 1 << 30 /* Indicates the client has a fully * parsed command ready for execution. */
	ClientTracking            ClientFlags = 1 << 31 /* Client enabled keys tracking in order to perform client side caching. */
	ClientTrackingBrokenRedir ClientFlags = 1 << 32 /* Target client is invalid. */
	ClientTrackingBCAST       ClientFlags = 1 << 33 /* Tracking in BCAST mode. */
	ClientTrackingOptIn       ClientFlags = 1 << 34 /* Tracking in opt-in mode. */
	ClientTrackingOptOut      ClientFlags = 1 << 35 /* Tracking in opt-out mode. */
	ClientTrackingCaching     ClientFlags = 1 << 36 /* CACHING yes/no was given, depending on optin/optout mode. */
	ClientTrackingNoLoop      ClientFlags = 1 << 37 /* Don't send invalidation messages about writes performed by myself.*/
	ClientInTimeoutTable      ClientFlags = 1 << 38 /* This client is in the timeout table. */
	ClientProtocolError       ClientFlags = 1 << 39 /* Protocol error chatting with it. */
	ClientCloseAfterCommand   ClientFlags = 1 << 40 /* Close after executing commands * and writing entire reply. */
	ClientDenyBlocking        ClientFlags = 1 << 41 /* Indicate that the client should not be blocked. currently, turned on inside MULTI, Lua, RM_Call, and AOF client */
	ClientReplRDBOnly         ClientFlags = 1 << 42 /* This client is a replica that only wants RDB without replication buffer. */
	ClientNoEvict             ClientFlags = 1 << 43 /* This client is protected against client memory eviction. */
	ClientAllowOOM            ClientFlags = 1 << 44 /* Client used by RM_Call is allowed to fully execute scripts even when in OOM */
	ClientNoTouch             ClientFlags = 1 << 45 /* This client will not touch LFU/LRU stats. */
	ClientPushing             ClientFlags = 1 << 46 /* This client is pushing notifications. */
)

type ClientInfo added in v9.0.4

type ClientInfo struct {
	ID                 int64         // redis version 2.8.12, a unique 64-bit client ID
	Addr               string        // address/port of the client
	LAddr              string        // address/port of local address client connected to (bind address)
	FD                 int64         // file descriptor corresponding to the socket
	Name               string        // the name set by the client with CLIENT SETNAME
	Age                time.Duration // total duration of the connection in seconds
	Idle               time.Duration // idle time of the connection in seconds
	Flags              ClientFlags   // client flags (see below)
	DB                 int           // current database ID
	Sub                int           // number of channel subscriptions
	PSub               int           // number of pattern matching subscriptions
	SSub               int           // redis version 7.0.3, number of shard channel subscriptions
	Multi              int           // number of commands in a MULTI/EXEC context
	Watch              int           // redis version 7.4 RC1, number of keys this client is currently watching.
	QueryBuf           int           // qbuf, query buffer length (0 means no query pending)
	QueryBufFree       int           // qbuf-free, free space of the query buffer (0 means the buffer is full)
	ArgvMem            int           // incomplete arguments for the next command (already extracted from query buffer)
	MultiMem           int           // redis version 7.0, memory is used up by buffered multi commands
	BufferSize         int           // rbs, usable size of buffer
	BufferPeak         int           // rbp, peak used size of buffer in last 5 sec interval
	OutputBufferLength int           // obl, output buffer length
	OutputListLength   int           // oll, output list length (replies are queued in this list when the buffer is full)
	OutputMemory       int           // omem, output buffer memory usage
	TotalMemory        int           // tot-mem, total memory consumed by this client in its various buffers
	TotalNetIn         int           // tot-net-in, total network input
	TotalNetOut        int           // tot-net-out, total network output
	TotalCmds          int           // tot-cmds, total number of commands processed
	IoThread           int           // io-thread id
	Events             string        // file descriptor events (see below)
	LastCmd            string        // cmd, last command played
	User               string        // the authenticated username of the client
	Redir              int64         // client id of current client tracking redirection
	Resp               int           // redis version 7.0, client RESP protocol version
	LibName            string        // redis version 7.2, client library name
	LibVer             string        // redis version 7.2, client library version
	ReadEvents         uint64        // redis version 8.8, number of read events processed
	AvgPipelineLenSum  uint64        // redis version 8.8, sum of pipeline lengths
	AvgPipelineLenCnt  uint64        // redis version 8.8, count of pipeline operations
}

ClientInfo is redis-server ClientInfo, not go-redis *Client

type ClientInfoCmd added in v9.0.4

type ClientInfoCmd struct {
	// contains filtered or unexported fields
}

func NewClientInfoCmd added in v9.0.4

func NewClientInfoCmd(ctx context.Context, args ...interface{}) *ClientInfoCmd

func (*ClientInfoCmd) Args added in v9.0.4

func (cmd *ClientInfoCmd) Args() []interface{}

func (*ClientInfoCmd) Clone added in v9.18.0

func (cmd *ClientInfoCmd) Clone() Cmder

func (*ClientInfoCmd) Err added in v9.0.4

func (cmd *ClientInfoCmd) Err() error

func (*ClientInfoCmd) FullName added in v9.0.4

func (cmd *ClientInfoCmd) FullName() string

func (*ClientInfoCmd) GetCmdType added in v9.18.0

func (cmd *ClientInfoCmd) GetCmdType() CmdType

func (*ClientInfoCmd) Name added in v9.0.4

func (cmd *ClientInfoCmd) Name() string

func (*ClientInfoCmd) NoRetry added in v9.19.0

func (cmd *ClientInfoCmd) NoRetry() bool

NoRetry returns true if the command should not be retried on failure. By default, commands can be retried. Commands that write directly to an io.Writer (like RawWriteToCmd) should override this to return true since partial writes cannot be undone on retry.

func (*ClientInfoCmd) Result added in v9.0.4

func (cmd *ClientInfoCmd) Result() (*ClientInfo, error)

func (*ClientInfoCmd) SetErr added in v9.0.4

func (cmd *ClientInfoCmd) SetErr(e error)

func (*ClientInfoCmd) SetFirstKeyPos added in v9.0.4

func (cmd *ClientInfoCmd) SetFirstKeyPos(keyPos int8)

func (*ClientInfoCmd) SetStepCount added in v9.18.0

func (cmd *ClientInfoCmd) SetStepCount(stepCount int8)

func (*ClientInfoCmd) SetVal added in v9.0.4

func (cmd *ClientInfoCmd) SetVal(val *ClientInfo)

func (*ClientInfoCmd) String added in v9.0.4

func (cmd *ClientInfoCmd) String() string

func (*ClientInfoCmd) Val added in v9.0.4

func (cmd *ClientInfoCmd) Val() *ClientInfo

type ClientSideCacheConfig added in v9.22.0

type ClientSideCacheConfig = CacheConfig

ClientSideCacheConfig configures the built-in client-side cache. Pass a non-nil value to Options.ClientSideCacheConfig to enable caching on a RESP3 client.

Experimental: this API may change in a minor release.

type ClientTrackingOptions added in v9.22.0

type ClientTrackingOptions struct {
	Redirect int64
	Bcast    bool
	Prefixes []string
	OptIn    bool
	OptOut   bool
	NoLoop   bool
}

ClientTrackingOptions configures CLIENT TRACKING ON. See https://redis.io/commands/client-tracking/ for semantics.

type ClusterClient

type ClusterClient struct {
	// contains filtered or unexported fields
}

ClusterClient is a Redis Cluster client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.

func NewClusterClient

func NewClusterClient(opt *ClusterOptions) *ClusterClient

NewClusterClient returns a Redis Cluster client as described in https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec. Passing nil ClusterOptions will cause a panic.

Example
package main

import (
	"context"

	"github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func main() {
	// See https://redis.io/docs/latest/operate/oss_and_stack/management/scaling for instructions
	// how to setup Redis Cluster.
	rdb := redis.NewClusterClient(&redis.ClusterOptions{
		Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
	})
	rdb.Ping(ctx)
}
Example (ManualSetup)

Following example creates a cluster from 2 master nodes and 2 slave nodes without using cluster mode or Redis Sentinel.

package main

import (
	"context"

	"github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func main() {
	// clusterSlots returns cluster slots information.
	// It can use service like ZooKeeper to maintain configuration information
	// and Cluster.ReloadState to manually trigger state reloading.
	clusterSlots := func(ctx context.Context) ([]redis.ClusterSlot, error) {
		slots := []redis.ClusterSlot{
			// First node with 1 master and 1 slave.
			{
				Start: 0,
				End:   8191,
				Nodes: []redis.ClusterNode{{
					Addr: ":7000", // master
				}, {
					Addr: ":8000", // 1st slave
				}},
			},
			// Second node with 1 master and 1 slave.
			{
				Start: 8192,
				End:   16383,
				Nodes: []redis.ClusterNode{{
					Addr: ":7001", // master
				}, {
					Addr: ":8001", // 1st slave
				}},
			},
		}
		return slots, nil
	}

	rdb := redis.NewClusterClient(&redis.ClusterOptions{
		ClusterSlots:  clusterSlots,
		RouteRandomly: true,
	})
	rdb.Ping(ctx)

	// ReloadState reloads cluster state. It calls ClusterSlots func
	// to get cluster slots information.
	rdb.ReloadState(ctx)
}

func NewFailoverClusterClient

func NewFailoverClusterClient(failoverOpt *FailoverOptions) *ClusterClient

NewFailoverClusterClient returns a client that supports routing read-only commands to a replica node. Passing nil FailoverOptions will cause a panic.

func (ClusterClient) ACLCat added in v9.7.2

func (c ClusterClient) ACLCat(ctx context.Context) *StringSliceCmd

func (ClusterClient) ACLCatArgs added in v9.7.2

func (c ClusterClient) ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd

func (ClusterClient) ACLDelUser added in v9.7.2

func (c ClusterClient) ACLDelUser(ctx context.Context, username string) *IntCmd

func (ClusterClient) ACLDryRun added in v9.0.3

func (c ClusterClient) ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd

func (ClusterClient) ACLGenPass added in v9.17.0

func (c ClusterClient) ACLGenPass(ctx context.Context, bit int) *StringCmd

func (ClusterClient) ACLList added in v9.7.2

func (c ClusterClient) ACLList(ctx context.Context) *StringSliceCmd

func (ClusterClient) ACLLog added in v9.0.5

func (c ClusterClient) ACLLog(ctx context.Context, count int64) *ACLLogCmd

func (ClusterClient) ACLLogReset added in v9.0.5

func (c ClusterClient) ACLLogReset(ctx context.Context) *StatusCmd

func (ClusterClient) ACLSetUser added in v9.7.2

func (c ClusterClient) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd

func (ClusterClient) ACLUsers added in v9.17.0

func (c ClusterClient) ACLUsers(ctx context.Context) *StringSliceCmd

func (ClusterClient) ACLWhoAmI added in v9.17.0

func (c ClusterClient) ACLWhoAmI(ctx context.Context) *StringCmd

func (ClusterClient) ARCount added in v9.20.0

func (c ClusterClient) ARCount(ctx context.Context, key string) *UintCmd

ARCount returns the number of non-empty elements in an array. Returns 0 if the key does not exist.

func (ClusterClient) ARDel added in v9.20.0

func (c ClusterClient) ARDel(ctx context.Context, key string, indexes ...uint64) *IntCmd

ARDel deletes elements at the specified indexes in an array. Returns the number of elements deleted.

func (ClusterClient) ARDelRange added in v9.20.0

func (c ClusterClient) ARDelRange(ctx context.Context, key string, ranges ...ARRange) *UintCmd

ARDelRange deletes elements in one or more ranges. Returns the number of elements deleted.

func (ClusterClient) ARGet added in v9.20.0

func (c ClusterClient) ARGet(ctx context.Context, key string, index uint64) *StringCmd

ARGet gets the value at an index in an array. Returns redis.Nil if the key or index does not exist.

func (ClusterClient) ARGetRange added in v9.20.0

func (c ClusterClient) ARGetRange(ctx context.Context, key string, start, end uint64) *SliceCmd

ARGetRange gets values in a range of indexes. Returns values in the range, with nil for unset indexes.

func (ClusterClient) ARGrep added in v9.20.0

func (c ClusterClient) ARGrep(ctx context.Context, key string, start, end string, grepArgs *ARGrepArgs) *UintSliceCmd

ARGrep searches array elements in a range using textual predicates. Returns matching indexes only. Use ARGrepWithValues to also get the values.

func (ClusterClient) ARGrepWithValues added in v9.20.0

func (c ClusterClient) ARGrepWithValues(ctx context.Context, key string, start, end string, grepArgs *ARGrepArgs) *AREntrySliceCmd

ARGrepWithValues searches array elements in a range using textual predicates. Returns matching indexes and their values as index-value pairs.

func (ClusterClient) ARInfo added in v9.20.0

func (c ClusterClient) ARInfo(ctx context.Context, key string) *MapStringInterfaceCmd

ARInfo returns metadata about an array.

func (ClusterClient) ARInfoFull added in v9.20.0

func (c ClusterClient) ARInfoFull(ctx context.Context, key string) *MapStringInterfaceCmd

ARInfoFull returns detailed metadata about an array including slice statistics.

func (ClusterClient) ARInsert added in v9.20.0

func (c ClusterClient) ARInsert(ctx context.Context, key string, values ...string) *UintCmd

ARInsert inserts one or more values at consecutive indexes. Returns the last index where a value was inserted.

func (ClusterClient) ARLastItems added in v9.20.0

func (c ClusterClient) ARLastItems(ctx context.Context, key string, count uint64, rev bool) *SliceCmd

ARLastItems returns the most recently inserted elements. When rev is true, returns items in reverse order.

func (ClusterClient) ARLen added in v9.20.0

func (c ClusterClient) ARLen(ctx context.Context, key string) *UintCmd

ARLen returns the length of an array (max index + 1). Returns 0 if the key does not exist.

func (ClusterClient) ARMGet added in v9.20.0

func (c ClusterClient) ARMGet(ctx context.Context, key string, indexes ...uint64) *SliceCmd

ARMGet gets values at multiple indexes in an array. Returns values at the specified indexes, with nil for unset indexes.

func (ClusterClient) ARMSet added in v9.20.0

func (c ClusterClient) ARMSet(ctx context.Context, key string, members ...AREntry) *IntCmd

ARMSet sets multiple index-value pairs in an array. Returns the number of new slots that were set (previously empty).

func (ClusterClient) ARNext added in v9.20.0

func (c ClusterClient) ARNext(ctx context.Context, key string) *UintCmd

ARNext returns the next index ARINSERT would use. Returns 0 for missing keys or when no insert happened yet. Returns nil when the insertion cursor is exhausted / would overflow.

func (ClusterClient) AROpAnd added in v9.20.0

func (c ClusterClient) AROpAnd(ctx context.Context, key string, start, end uint64) *IntCmd

AROpAnd returns the bitwise AND of integer elements in a range.

func (ClusterClient) AROpMatch added in v9.20.0

func (c ClusterClient) AROpMatch(ctx context.Context, key string, start, end uint64, value string) *IntCmd

AROpMatch returns the count of elements matching a target string in a range.

func (ClusterClient) AROpMax added in v9.20.0

func (c ClusterClient) AROpMax(ctx context.Context, key string, start, end uint64) *StringCmd

AROpMax returns the maximum numeric element in a range.

func (ClusterClient) AROpMin added in v9.20.0

func (c ClusterClient) AROpMin(ctx context.Context, key string, start, end uint64) *StringCmd

AROpMin returns the minimum numeric element in a range.

func (ClusterClient) AROpOr added in v9.20.0

func (c ClusterClient) AROpOr(ctx context.Context, key string, start, end uint64) *IntCmd

AROpOr returns the bitwise OR of integer elements in a range.

func (ClusterClient) AROpSum added in v9.20.0

func (c ClusterClient) AROpSum(ctx context.Context, key string, start, end uint64) *StringCmd

AROpSum returns the sum of numeric elements in a range.

func (ClusterClient) AROpUsed added in v9.20.0

func (c ClusterClient) AROpUsed(ctx context.Context, key string, start, end uint64) *IntCmd

AROpUsed returns the count of non-empty slots in a range.

func (ClusterClient) AROpXor added in v9.20.0

func (c ClusterClient) AROpXor(ctx context.Context, key string, start, end uint64) *IntCmd

AROpXor returns the bitwise XOR of integer elements in a range.

func (ClusterClient) ARRing added in v9.20.0

func (c ClusterClient) ARRing(ctx context.Context, key string, size uint64, values ...string) *UintCmd

ARRing inserts values into a ring buffer of specified size, wrapping and truncating as needed. Returns the last index where a value was inserted.

func (ClusterClient) ARScan added in v9.20.0

func (c ClusterClient) ARScan(ctx context.Context, key string, start, end uint64, scanArgs *ARScanArgs) *AREntrySliceCmd

ARScan iterates existing elements in a range, returning index-value pairs.

func (ClusterClient) ARSeek added in v9.20.0

func (c ClusterClient) ARSeek(ctx context.Context, key string, index uint64) *IntCmd

ARSeek sets the ARINSERT / ARRING cursor to a specific index. Returns 1 if the cursor was set, 0 if the key does not exist.

func (ClusterClient) ARSet added in v9.20.0

func (c ClusterClient) ARSet(ctx context.Context, key string, index uint64, values ...string) *IntCmd

ARSet sets one or more contiguous values starting at an index in an array. Returns the number of new slots that were set (previously empty).

func (*ClusterClient) AddHook

func (hs *ClusterClient) AddHook(hook Hook)

AddHook is to add a hook to the queue. Hook is a function executed during network connection, command execution, and pipeline, it is a first-in-first-out stack queue (FIFO). You need to execute the next hook in each hook, unless you want to terminate the execution of the command. For example, you added hook-1, hook-2:

client.AddHook(hook-1, hook-2)

hook-1:

func (Hook1) ProcessHook(next redis.ProcessHook) redis.ProcessHook {
 	return func(ctx context.Context, cmd Cmder) error {
	 	print("hook-1 start")
	 	next(ctx, cmd)
	 	print("hook-1 end")
	 	return nil
 	}
}

hook-2:

func (Hook2) ProcessHook(next redis.ProcessHook) redis.ProcessHook {
	return func(ctx context.Context, cmd redis.Cmder) error {
		print("hook-2 start")
		next(ctx, cmd)
		print("hook-2 end")
		return nil
	}
}

The execution sequence is:

hook-1 start -> hook-2 start -> exec redis cmd -> hook-2 end -> hook-1 end

Please note: "next(ctx, cmd)" is very important, it will call the next hook, if "next(ctx, cmd)" is not executed, the redis command will not be executed.

Contract. A hook runs inside the client's command machinery and must be well-behaved, or behavior is undefined:

  • Call next (as above) unless deliberately terminating the command.
  • Do not call Close or other client control methods from a hook — the hook runs on the goroutine Close waits for, so this deadlocks.
  • Do not panic. A panicking hook can crash the process or leave an operation unsettled; wrap fallible work and return an error instead.
  • Do not mutate client or connection state. A hook may observe and wrap errors (call cmd.SetErr) but must not reconfigure the client mid-flight.

func (ClusterClient) Append

func (c ClusterClient) Append(ctx context.Context, key, value string) *IntCmd

func (*ClusterClient) AsyncAutoPipeline added in v9.22.0

func (c *ClusterClient) AsyncAutoPipeline() (*AutoPipeliner, error)

AsyncAutoPipeline returns the deferred autopipeliner: command calls return immediately and the result accessors block. Submit a window then read results for the highest throughput. By default, ClusterOptions.AutoPipelineOptions is used if set, otherwise DefaultAutoPipelineOptions. Ordering across nodes is per key: slot routing keeps a key on one shard, and node sub-pipelines execute concurrently. Use AsyncAutoPipelineWithOptions to override. Cached/shared; first call's config wins.

It returns an error if the supplied config is invalid (e.g. MaxConcurrentBatches>1 without Unordered, or a negative size); on error no instance is cached.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*ClusterClient) AsyncAutoPipelineWithOptions added in v9.22.0

func (c *ClusterClient) AsyncAutoPipelineWithOptions(config *AutoPipelineOptions) (*AutoPipeliner, error)

AsyncAutoPipelineWithOptions is AsyncAutoPipeline with an explicit config instead of ClusterOptions.AutoPipelineOptions / the default. Cached/shared.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*ClusterClient) AutoPipeline added in v9.22.0

func (c *ClusterClient) AutoPipeline() (*AutoPipeliner, error)

AutoPipeline returns the blocking autopipeliner for this cluster client: each command call blocks until executed (drop-in shape) while the engine batches concurrent callers into pipelines. Commands keep per-goroutine order; across nodes, ordering is per key (slot routing keeps a key on one shard and node sub-pipelines execute concurrently). Use AutoPipelineWithOptions to override DefaultBlockingAutoPipelineOptions. Cached/shared; first call's config wins. Close it (or the client) to release its goroutines.

It returns an error if the supplied config is invalid (e.g. MaxConcurrentBatches>1 without Unordered, or a negative size); on error no instance is cached.

EXPERIMENTAL: this API is subject to change, use with caution.

func (*ClusterClient) AutoPipelineWithOptions added in v9.22.0

func (c *ClusterClient) AutoPipelineWithOptions(config *AutoPipelineOptions) (*AutoPipeliner, error)

AutoPipelineWithOptions is AutoPipeline with explicit options instead of ClusterOptions.AutoPipelineOptions / the default. Cached/shared; first call wins.

EXPERIMENTAL: this API is subject to change, use with caution.

func (ClusterClient) BFAdd added in v9.1.0

func (c ClusterClient) BFAdd(ctx context.Context, key string, element interface{}) *BoolCmd

BFAdd adds an item to a Bloom filter. For more information - https://redis.io/commands/bf.add/

func (ClusterClient) BFCard added in v9.1.0

func (c ClusterClient) BFCard(ctx context.Context, key string) *IntCmd

BFCard returns the cardinality of a Bloom filter - number of items that were added to a Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter). For more information - https://redis.io/commands/bf.card/

func (ClusterClient) BFExists added in v9.1.0

func (c ClusterClient) BFExists(ctx context.Context, key string, element interface{}) *BoolCmd

BFExists determines whether a given item was added to a Bloom filter. For more information - https://redis.io/commands/bf.exists/

func (ClusterClient) BFInfo added in v9.1.0

func (c ClusterClient) BFInfo(ctx context.Context, key string) *BFInfoCmd

Returns information about a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInfoArg added in v9.1.0

func (c ClusterClient) BFInfoArg(ctx context.Context, key, option string) *BFInfoCmd

BFInfoArg returns information about a specific option of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInfoCapacity added in v9.1.0

func (c ClusterClient) BFInfoCapacity(ctx context.Context, key string) *BFInfoCmd

BFInfoCapacity returns information about the capacity of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInfoExpansion added in v9.1.0

func (c ClusterClient) BFInfoExpansion(ctx context.Context, key string) *BFInfoCmd

BFInfoExpansion returns information about the expansion rate of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInfoFilters added in v9.1.0

func (c ClusterClient) BFInfoFilters(ctx context.Context, key string) *BFInfoCmd

BFInfoFilters returns information about the filters of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInfoItems added in v9.1.0

func (c ClusterClient) BFInfoItems(ctx context.Context, key string) *BFInfoCmd

BFInfoItems returns information about the items of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInfoSize added in v9.1.0

func (c ClusterClient) BFInfoSize(ctx context.Context, key string) *BFInfoCmd

BFInfoSize returns information about the size of a Bloom filter. For more information - https://redis.io/commands/bf.info/

func (ClusterClient) BFInsert added in v9.1.0

func (c ClusterClient) BFInsert(ctx context.Context, key string, options *BFInsertOptions, elements ...interface{}) *BoolSliceCmd

BFInsert inserts elements into a Bloom filter. This function also allows for specifying additional options such as: capacity, error rate, expansion rate, and non-scaling behavior. For more information - https://redis.io/commands/bf.insert/

func (ClusterClient) BFLoadChunk added in v9.1.0

func (c ClusterClient) BFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd

BFLoadChunk restores a Bloom filter previously saved using BF.SCANDUMP. For more information - https://redis.io/commands/bf.loadchunk/

func (ClusterClient) BFMAdd added in v9.1.0

func (c ClusterClient) BFMAdd(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

BFMAdd adds multiple elements to a Bloom filter. Returns an array of booleans indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/bf.madd/

func (ClusterClient) BFMExists added in v9.1.0

func (c ClusterClient) BFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

BFMExists check if multiple elements exist in a Bloom filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/bf.mexists/

func (ClusterClient) BFReserve added in v9.1.0

func (c ClusterClient) BFReserve(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd

BFReserve creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. For more information - https://redis.io/commands/bf.reserve/

func (ClusterClient) BFReserveExpansion added in v9.1.0

func (c ClusterClient) BFReserveExpansion(ctx context.Context, key string, errorRate float64, capacity, expansion int64) *StatusCmd

BFReserveExpansion creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying an expansion rate for the filter. For more information - https://redis.io/commands/bf.reserve/

func (ClusterClient) BFReserveNonScaling added in v9.1.0

func (c ClusterClient) BFReserveNonScaling(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd

BFReserveNonScaling creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying that the filter should not scale. For more information - https://redis.io/commands/bf.reserve/

func (ClusterClient) BFReserveWithArgs added in v9.2.0

func (c ClusterClient) BFReserveWithArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd

BFReserveWithArgs creates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error_rate. This function also allows for specifying additional options such as expansion rate and non-scaling behavior. For more information - https://redis.io/commands/bf.reserve/

func (ClusterClient) BFScanDump added in v9.1.0

func (c ClusterClient) BFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd

Begins an incremental save of the Bloom filter. This command is useful for large Bloom filters that cannot fit into the DUMP and RESTORE model. For more information - https://redis.io/commands/bf.scandump/

func (ClusterClient) BLMPop added in v9.0.3

func (c ClusterClient) BLMPop(ctx context.Context, timeout time.Duration, direction string, count int64, keys ...string) *KeyValuesCmd

func (ClusterClient) BLMove

func (c ClusterClient) BLMove(
	ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration,
) *StringCmd

func (ClusterClient) BLMoveM added in v9.22.0

func (c ClusterClient) BLMoveM(ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration, a LMoveMArgs) *StringSliceCmd

BLMoveM is the blocking variant of LMoveM (Redis 8.10+); timeout 0 blocks forever. Returns moved elements, or redis.Nil on timeout.

func (ClusterClient) BLPop

func (c ClusterClient) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd

func (ClusterClient) BRPop

func (c ClusterClient) BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd

func (ClusterClient) BRPopLPush deprecated

func (c ClusterClient) BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *StringCmd

BRPopLPush pops an element from a list, pushes it to another list and returns it. Blocks until an element is available or timeout is reached.

Deprecated: Use BLMove with RIGHT and LEFT arguments instead as of Redis 6.2.0.

func (ClusterClient) BZMPop added in v9.0.3

func (c ClusterClient) BZMPop(ctx context.Context, timeout time.Duration, order string, count int64, keys ...string) *ZSliceWithKeyCmd

BZMPop is the blocking variant of ZMPOP. When any of the sorted sets contains elements, this command behaves exactly like ZMPOP. When all sorted sets are empty, Redis will block the connection until another client adds members to one of the keys or until the timeout elapses. A timeout of zero can be used to block indefinitely. example: client.BZMPop(ctx, 0,"max", 1, "set")

func (ClusterClient) BZPopMax

func (c ClusterClient) BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd

BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.

func (ClusterClient) BZPopMin

func (c ClusterClient) BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd

BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.

func (ClusterClient) BgRewriteAOF

func (c ClusterClient) BgRewriteAOF(ctx context.Context) *StatusCmd

func (ClusterClient) BgSave

func (c ClusterClient) BgSave(ctx context.Context) *StatusCmd

func (ClusterClient) BitCount

func (c ClusterClient) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd

func (ClusterClient) BitField

func (c ClusterClient) BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd

BitField accepts multiple values:

  • BitField("set", "i1", "offset1", "value1","cmd2", "type2", "offset2", "value2")
  • BitField([]string{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
  • BitField([]interface{}{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})

func (ClusterClient) BitFieldRO added in v9.3.1

func (c ClusterClient) BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd

BitFieldRO - Read-only variant of the BITFIELD command. It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas. - BitFieldRO(ctx, key, "<Encoding0>", "<Offset0>", "<Encoding1>","<Offset1>")

func (ClusterClient) BitOpAnd

func (c ClusterClient) BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpAnd creates a new bitmap in which users are members of all given bitmaps

func (ClusterClient) BitOpAndOr added in v9.12.0

func (c ClusterClient) BitOpAndOr(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpAndOr creates a new bitmap in which users are members of bitmap X and also members of one or more of bitmaps Y1, Y2, … Introduced with Redis 8.2

func (ClusterClient) BitOpDiff added in v9.12.0

func (c ClusterClient) BitOpDiff(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpDiff creates a new bitmap in which users are members of bitmap X but not of any of bitmaps Y1, Y2, … Introduced with Redis 8.2

func (ClusterClient) BitOpDiff1 added in v9.12.0

func (c ClusterClient) BitOpDiff1(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpDiff1 creates a new bitmap in which users are members of one or more of bitmaps Y1, Y2, … but not members of bitmap X Introduced with Redis 8.2

func (ClusterClient) BitOpNot

func (c ClusterClient) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd

BitOpNot creates a new bitmap in which users are not members of a given bitmap

func (ClusterClient) BitOpOne added in v9.12.0

func (c ClusterClient) BitOpOne(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpOne creates a new bitmap in which users are members of exactly one of the given bitmaps Introduced with Redis 8.2

func (ClusterClient) BitOpOr

func (c ClusterClient) BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpOr creates a new bitmap in which users are member of at least one given bitmap

func (ClusterClient) BitOpXor

func (c ClusterClient) BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd

BitOpXor creates a new bitmap in which users are the result of XORing all given bitmaps

func (ClusterClient) BitPos

func (c ClusterClient) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd

BitPos is an API before Redis version 7.0, cmd: bitpos key bit start end if you need the `byte | bit` parameter, please use `BitPosSpan`.

func (ClusterClient) BitPosSpan added in v9.0.3

func (c ClusterClient) BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *IntCmd

BitPosSpan supports the `byte | bit` parameters in redis version 7.0, the bitpos command defaults to using byte type for the `start-end` range, which means it counts in bytes from start to end. you can set the value of "span" to determine the type of `start-end`. span = "bit", cmd: bitpos key bit start end bit span = "byte", cmd: bitpos key bit start end byte

func (ClusterClient) CFAdd added in v9.1.0

func (c ClusterClient) CFAdd(ctx context.Context, key string, element interface{}) *BoolCmd

CFAdd adds an element to a Cuckoo filter. Returns true if the element was added to the filter or false if it already exists in the filter. For more information - https://redis.io/commands/cf.add/

func (ClusterClient) CFAddNX added in v9.1.0

func (c ClusterClient) CFAddNX(ctx context.Context, key string, element interface{}) *BoolCmd

CFAddNX adds an element to a Cuckoo filter only if it does not already exist in the filter. Returns true if the element was added to the filter or false if it already exists in the filter. For more information - https://redis.io/commands/cf.addnx/

func (ClusterClient) CFCount added in v9.1.0

func (c ClusterClient) CFCount(ctx context.Context, key string, element interface{}) *IntCmd

CFCount returns an estimate of the number of times an element may be in a Cuckoo Filter. For more information - https://redis.io/commands/cf.count/

func (ClusterClient) CFDel added in v9.1.0

func (c ClusterClient) CFDel(ctx context.Context, key string, element interface{}) *BoolCmd

CFDel deletes an item once from the cuckoo filter. For more information - https://redis.io/commands/cf.del/

func (ClusterClient) CFExists added in v9.1.0

func (c ClusterClient) CFExists(ctx context.Context, key string, element interface{}) *BoolCmd

CFExists determines whether an item may exist in the Cuckoo Filter or not. For more information - https://redis.io/commands/cf.exists/

func (ClusterClient) CFInfo added in v9.1.0

func (c ClusterClient) CFInfo(ctx context.Context, key string) *CFInfoCmd

CFInfo returns information about a Cuckoo filter. For more information - https://redis.io/commands/cf.info/

func (ClusterClient) CFInsert added in v9.1.0

func (c ClusterClient) CFInsert(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *BoolSliceCmd

CFInsert inserts elements into a Cuckoo filter. This function also allows for specifying additional options such as capacity, error rate, expansion rate, and non-scaling behavior. Returns an array of booleans indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/cf.insert/

func (ClusterClient) CFInsertNX added in v9.1.0

func (c ClusterClient) CFInsertNX(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *IntSliceCmd

CFInsertNX inserts elements into a Cuckoo filter only if they do not already exist in the filter. This function also allows for specifying additional options such as: capacity, error rate, expansion rate, and non-scaling behavior. Returns an array of integers indicating whether each element was added to the filter or not. For more information - https://redis.io/commands/cf.insertnx/

func (ClusterClient) CFLoadChunk added in v9.1.0

func (c ClusterClient) CFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd

CFLoadChunk restores a filter previously saved using SCANDUMP. For more information - https://redis.io/commands/cf.loadchunk/

func (ClusterClient) CFMExists added in v9.1.0

func (c ClusterClient) CFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd

CFMExists check if multiple elements exist in a Cuckoo filter. Returns an array of booleans indicating whether each element exists in the filter or not. For more information - https://redis.io/commands/cf.mexists/

func (ClusterClient) CFReserve added in v9.1.0

func (c ClusterClient) CFReserve(ctx context.Context, key string, capacity int64) *StatusCmd

CFReserve creates an empty Cuckoo filter with the specified capacity. For more information - https://redis.io/commands/cf.reserve/

func (ClusterClient) CFReserveBucketSize added in v9.1.0

func (c ClusterClient) CFReserveBucketSize(ctx context.Context, key string, capacity int64, bucketsize int64) *StatusCmd

CFReserveBucketSize creates an empty Cuckoo filter with the specified capacity and bucket size. For more information - https://redis.io/commands/cf.reserve/

func (ClusterClient) CFReserveExpansion added in v9.1.0

func (c ClusterClient) CFReserveExpansion(ctx context.Context, key string, capacity int64, expansion int64) *StatusCmd

CFReserveExpansion creates an empty Cuckoo filter with the specified capacity and expansion rate. For more information - https://redis.io/commands/cf.reserve/

func (ClusterClient) CFReserveMaxIterations added in v9.1.0

func (c ClusterClient) CFReserveMaxIterations(ctx context.Context, key string, capacity int64, maxiterations int64) *StatusCmd

CFReserveMaxIterations creates an empty Cuckoo filter with the specified capacity and maximum number of iterations. For more information - https://redis.io/commands/cf.reserve/

func (ClusterClient) CFReserveWithArgs added in v9.2.0

func (c ClusterClient) CFReserveWithArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd

CFReserveWithArgs creates an empty Cuckoo filter with the specified options. This function allows for specifying additional options such as bucket size and maximum number of iterations. For more information - https://redis.io/commands/cf.reserve/

func (ClusterClient) CFScanDump added in v9.1.0

func (c ClusterClient) CFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd

CFScanDump begins an incremental save of the cuckoo filter. For more information - https://redis.io/commands/cf.scandump/

func (ClusterClient) CMSIncrBy added in v9.1.0

func (c ClusterClient) CMSIncrBy(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

CMSIncrBy increments the count of one or more items in a Count-Min Sketch filter. Returns an array of integers representing the updated count of each item. For more information - https://redis.io/commands/cms.incrby/

func (ClusterClient) CMSInfo added in v9.1.0

func (c ClusterClient) CMSInfo(ctx context.Context, key string) *CMSInfoCmd

CMSInfo returns information about a Count-Min Sketch filter. For more information - https://redis.io/commands/cms.info/

func (ClusterClient) CMSInitByDim added in v9.1.0

func (c ClusterClient) CMSInitByDim(ctx context.Context, key string, width, depth int64) *StatusCmd

CMSInitByDim creates an empty Count-Min Sketch filter with the specified dimensions. For more information - https://redis.io/commands/cms.initbydim/

func (ClusterClient) CMSInitByProb added in v9.1.0

func (c ClusterClient) CMSInitByProb(ctx context.Context, key string, errorRate, probability float64) *StatusCmd

CMSInitByProb creates an empty Count-Min Sketch filter with the specified error rate and probability. For more information - https://redis.io/commands/cms.initbyprob/

func (ClusterClient) CMSMerge added in v9.1.0

func (c ClusterClient) CMSMerge(ctx context.Context, destKey string, sourceKeys ...string) *StatusCmd

CMSMerge merges multiple Count-Min Sketch filters into a single filter. The destination filter must not exist and will be created with the dimensions of the first source filter. The number of items in each source filter must be equal. Returns OK on success or an error if the filters could not be merged. For more information - https://redis.io/commands/cms.merge/

func (ClusterClient) CMSMergeWithWeight added in v9.1.0

func (c ClusterClient) CMSMergeWithWeight(ctx context.Context, destKey string, sourceKeys map[string]int64) *StatusCmd

CMSMergeWithWeight merges multiple Count-Min Sketch filters into a single filter with weights for each source filter. The destination filter must not exist and will be created with the dimensions of the first source filter. The number of items in each source filter must be equal. Returns OK on success or an error if the filters could not be merged. For more information - https://redis.io/commands/cms.merge/

func (ClusterClient) CMSQuery added in v9.1.0

func (c ClusterClient) CMSQuery(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd

CMSQuery returns count for item(s). For more information - https://redis.io/commands/cms.query/

func (ClusterClient) ClientGetName

func (c ClusterClient) ClientGetName(ctx context.Context) *StringCmd

ClientGetName returns the name of the connection.

func (ClusterClient) ClientID

func (c ClusterClient) ClientID(ctx context.Context) *IntCmd

func (ClusterClient) ClientInfo added in v9.0.4

func (c ClusterClient) ClientInfo(ctx context.Context) *ClientInfoCmd

func (ClusterClient) ClientKill

func (c ClusterClient) ClientKill(ctx context.Context, ipPort string) *StatusCmd

func (ClusterClient) ClientKillByFilter

func (c ClusterClient) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (ClusterClient) ClientList

func (c ClusterClient) ClientList(ctx context.Context) *StringCmd

func (ClusterClient) ClientMaintNotifications added in v9.15.0

func (c ClusterClient) ClientMaintNotifications(ctx context.Context, enabled bool, endpointType string) *StatusCmd

ClientMaintNotifications enables or disables maintenance notifications for maintenance upgrades. When enabled, the client will receive push notifications about Redis maintenance events.

func (ClusterClient) ClientPause

func (c ClusterClient) ClientPause(ctx context.Context, dur time.Duration) *BoolCmd

func (ClusterClient) ClientTracking added in v9.22.0

func (c ClusterClient) ClientTracking(ctx context.Context, on bool, opt *ClientTrackingOptions) *StatusCmd

ClientTracking enables or disables server-assisted client-side caching for the ONE connection that happens to serve this command. On a pooled client that connection is arbitrary, so this is only meaningful on a dedicated connection (see Client.Conn). When on is false, opt is ignored. Invalid option combinations are reported via the returned command's Err and nothing is sent to the server.

Must not be combined with the built-in client-side cache: on a client configured with Options.ClientSideCache or ClientSideCacheConfig this command is rejected, because changing a pool connection's tracking state would silently break the cache's invalidation.

func (ClusterClient) ClientTrackingOff added in v9.22.0

func (c ClusterClient) ClientTrackingOff(ctx context.Context) *StatusCmd

ClientTrackingOff disables tracking on the serving connection. See ClientTracking for the pooled-client and built-in-CSC caveats.

func (ClusterClient) ClientTrackingOn added in v9.22.0

func (c ClusterClient) ClientTrackingOn(ctx context.Context, opt *ClientTrackingOptions) *StatusCmd

ClientTrackingOn enables tracking on the serving connection. See ClientTracking for the pooled-client and built-in-CSC caveats.

func (ClusterClient) ClientUnblock

func (c ClusterClient) ClientUnblock(ctx context.Context, id int64) *IntCmd

func (ClusterClient) ClientUnblockWithError

func (c ClusterClient) ClientUnblockWithError(ctx context.Context, id int64) *IntCmd

func (ClusterClient) ClientUnpause

func (c ClusterClient) ClientUnpause(ctx context.Context) *BoolCmd

func (*ClusterClient) Close

func (c *ClusterClient) Close() error

Close closes the cluster client, releasing any open resources.

It is rare to Close a ClusterClient, as the ClusterClient is meant to be long-lived and shared between many goroutines.

func (ClusterClient) ClusterAddSlots

func (c ClusterClient) ClusterAddSlots(ctx context.Context, slots ...int) *StatusCmd

func (ClusterClient) ClusterAddSlotsRange

func (c ClusterClient) ClusterAddSlotsRange(ctx context.Context, min, max int) *StatusCmd

func (ClusterClient) ClusterCountFailureReports

func (c ClusterClient) ClusterCountFailureReports(ctx context.Context, nodeID string) *IntCmd

func (ClusterClient) ClusterCountKeysInSlot

func (c ClusterClient) ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd

func (ClusterClient) ClusterDelSlots

func (c ClusterClient) ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd

func (ClusterClient) ClusterDelSlotsRange

func (c ClusterClient) ClusterDelSlotsRange(ctx context.Context, min, max int) *StatusCmd

func (ClusterClient) ClusterFailover

func (c ClusterClient) ClusterFailover(ctx context.Context) *StatusCmd

func (ClusterClient) ClusterForget

func (c ClusterClient) ClusterForget(ctx context.Context, nodeID string) *StatusCmd

func (ClusterClient) ClusterGetKeysInSlot

func (c ClusterClient) ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *StringSliceCmd

func (ClusterClient) ClusterInfo

func (c ClusterClient) ClusterInfo(ctx context.Context) *StringCmd

func (ClusterClient) ClusterKeySlot

func (c ClusterClient) ClusterKeySlot(ctx context.Context, key string) *IntCmd
func (c ClusterClient) ClusterLinks(ctx context.Context) *ClusterLinksCmd

func (ClusterClient) ClusterMeet

func (c ClusterClient) ClusterMeet(ctx context.Context, host, port string) *StatusCmd

func (ClusterClient) ClusterMyID added in v9.8.0

func (c ClusterClient) ClusterMyID(ctx context.Context) *StringCmd

func (ClusterClient) ClusterMyShardID added in v9.0.4

func (c ClusterClient) ClusterMyShardID(ctx context.Context) *StringCmd

func (ClusterClient) ClusterNodes

func (c ClusterClient) ClusterNodes(ctx context.Context) *StringCmd

func (ClusterClient) ClusterReplicate

func (c ClusterClient) ClusterReplicate(ctx context.Context, nodeID string) *StatusCmd

func (ClusterClient) ClusterResetHard

func (c ClusterClient) ClusterResetHard(ctx context.Context) *StatusCmd

func (ClusterClient) ClusterResetSoft

func (c ClusterClient) ClusterResetSoft(ctx context.Context) *StatusCmd

func (ClusterClient) ClusterSaveConfig

func (c ClusterClient) ClusterSaveConfig(ctx context.Context) *StatusCmd

func (ClusterClient) ClusterShards added in v9.0.3

func (c ClusterClient) ClusterShards(ctx context.Context) *ClusterShardsCmd

func (ClusterClient) ClusterSlaves deprecated

func (c ClusterClient) ClusterSlaves(ctx context.Context, nodeID string) *StringSliceCmd

ClusterSlaves lists the replica nodes of a master node.

Deprecated: Use ClusterReplicas instead as of Redis 5.0.0.

func (ClusterClient) ClusterSlots deprecated

func (c ClusterClient) ClusterSlots(ctx context.Context) *ClusterSlotsCmd

ClusterSlots returns the mapping of cluster slots to nodes.

Deprecated: Use ClusterShards instead as of Redis 7.0.0.

func (ClusterClient) Command

func (c ClusterClient) Command(ctx context.Context) *CommandsInfoCmd

func (ClusterClient) CommandGetKeys added in v9.0.3

func (c ClusterClient) CommandGetKeys(ctx context.Context, commands ...interface{}) *StringSliceCmd

func (ClusterClient) CommandGetKeysAndFlags added in v9.0.3

func (c ClusterClient) CommandGetKeysAndFlags(ctx context.Context, commands ...interface{}) *KeyFlagsCmd

func (ClusterClient) CommandList added in v9.0.3

func (c ClusterClient) CommandList(ctx context.Context, filter *FilterBy) *StringSliceCmd

func (ClusterClient) ConfigGet

func (c ClusterClient) ConfigGet(ctx context.Context, parameter string) *MapStringStringCmd

func (ClusterClient) ConfigResetStat

func (c ClusterClient) ConfigResetStat(ctx context.Context) *StatusCmd

func (ClusterClient) ConfigRewrite

func (c ClusterClient) ConfigRewrite(ctx context.Context) *StatusCmd

func (ClusterClient) ConfigSet

func (c ClusterClient) ConfigSet(ctx context.Context, parameter, value string) *StatusCmd

func (ClusterClient) Copy

func (c ClusterClient) Copy(ctx context.Context, sourceKey, destKey string, db int, replace bool) *IntCmd

func (*ClusterClient) DBSize

func (c *ClusterClient) DBSize(ctx context.Context) *IntCmd

func (ClusterClient) DebugObject

func (c ClusterClient) DebugObject(ctx context.Context, key string) *StringCmd

func (ClusterClient) Decr

func (c ClusterClient) Decr(ctx context.Context, key string) *IntCmd

func (ClusterClient) DecrBy

func (c ClusterClient) DecrBy(ctx context.Context, key string, decrement int64) *IntCmd

func (ClusterClient) Del

func (c ClusterClient) Del(ctx context.Context, keys ...string) *IntCmd

func (ClusterClient) DelExArgs added in v9.17.0

func (c ClusterClient) DelExArgs(ctx context.Context, key string, a DelExArgs) *IntCmd

DelExArgs Redis `DELEX key [IFEQ|IFNE|IFDEQ|IFDNE] match-value` command. Compare-and-delete with flexible conditions.

Returns the number of keys that were removed (0 or 1).

NOTE DelExArgs is still experimental it's signature and behaviour may change

func (ClusterClient) Digest added in v9.17.0

func (c ClusterClient) Digest(ctx context.Context, key string) *DigestCmd

Digest returns the xxh3 hash (uint64) of the specified key's value.

The digest is a 64-bit xxh3 hash that can be used for optimistic locking with SetIFDEQ, SetIFDNE, and DelExArgs commands.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/digest/

NOTE Digest is still experimental it's signature and behaviour may change

func (ClusterClient) Do

func (c ClusterClient) Do(ctx context.Context, args ...interface{}) *Cmd

func (ClusterClient) DoRaw added in v9.19.0

func (c ClusterClient) DoRaw(ctx context.Context, args ...interface{}) *RawCmd

DoRaw executes a command and returns the raw RESP protocol bytes without parsing.

func (ClusterClient) DoRawWriteTo added in v9.19.0

func (c ClusterClient) DoRawWriteTo(ctx context.Context, w io.Writer, args ...interface{}) *RawWriteToCmd

DoRawWriteTo executes a command and streams raw RESP bytes directly to w without intermediate allocations.

func (ClusterClient) Dump

func (c ClusterClient) Dump(ctx context.Context, key string) *StringCmd

func (ClusterClient) Echo

func (c ClusterClient) Echo(ctx context.Context, message interface{}) *StringCmd

func (ClusterClient) Eval

func (c ClusterClient) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd

func (ClusterClient) EvalRO

func (c ClusterClient) EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd

func (ClusterClient) EvalSha

func (c ClusterClient) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd

func (ClusterClient) EvalShaRO

func (c ClusterClient) EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd

func (ClusterClient) Exists

func (c ClusterClient) Exists(ctx context.Context, keys ...string) *IntCmd

func (ClusterClient) Expire

func (c ClusterClient) Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (ClusterClient) ExpireAt

func (c ClusterClient) ExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd

func (ClusterClient) ExpireGT

func (c ClusterClient) ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (ClusterClient) ExpireLT

func (c ClusterClient) ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (ClusterClient) ExpireNX

func (c ClusterClient) ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (ClusterClient) ExpireTime added in v9.0.3

func (c ClusterClient) ExpireTime(ctx context.Context, key string) *DurationCmd

ExpireTime returns the absolute expiration time of key as a Unix timestamp encoded in *DurationCmd (seconds since the epoch), not a remaining TTL. Convert with: time.Unix(int64(d/time.Second), 0). Use TTL/PTTL for remaining TTL.

func (ClusterClient) ExpireXX

func (c ClusterClient) ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (ClusterClient) FCall added in v9.0.3

func (c ClusterClient) FCall(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

func (ClusterClient) FCallRO added in v9.0.4

func (c ClusterClient) FCallRO(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

func (ClusterClient) FCallRo added in v9.0.3

func (c ClusterClient) FCallRo(ctx context.Context, function string, keys []string, args ...interface{}) *Cmd

FCallRo this function simply calls FCallRO, Deprecated: to maintain convention FCallRO.

func (ClusterClient) FTAggregate added in v9.5.4

func (c ClusterClient) FTAggregate(ctx context.Context, index string, query string) *MapStringInterfaceCmd

FTAggregate - Performs a search query on an index and applies a series of aggregate transformations to the result. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. For more information, please refer to the Redis documentation: [FT.AGGREGATE]: (https://redis.io/commands/ft.aggregate/)

func (ClusterClient) FTAggregateWithArgs added in v9.5.4

func (c ClusterClient) FTAggregateWithArgs(ctx context.Context, index string, query string, options *FTAggregateOptions) *AggregateCmd

FTAggregateWithArgs - Performs a search query on an index and applies a series of aggregate transformations to the result. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. This function also allows for specifying additional options such as: Verbatim, LoadAll, Load, Timeout, GroupBy, SortBy, SortByMax, Apply, LimitOffset, Limit, Filter, WithCursor, Params, and DialectVersion. For more information, please refer to the Redis documentation: [FT.AGGREGATE]: (https://redis.io/commands/ft.aggregate/)

func (ClusterClient) FTAliasAdd added in v9.5.4

func (c ClusterClient) FTAliasAdd(ctx context.Context, index string, alias string) *StatusCmd

FTAliasAdd - Adds an alias to an index. The 'index' parameter specifies the index to which the alias is added, and the 'alias' parameter specifies the alias. For more information, please refer to the Redis documentation: [FT.ALIASADD]: (https://redis.io/commands/ft.aliasadd/)

func (ClusterClient) FTAliasDel added in v9.5.4

func (c ClusterClient) FTAliasDel(ctx context.Context, alias string) *StatusCmd

FTAliasDel - Removes an alias from an index. The 'alias' parameter specifies the alias to be removed. For more information, please refer to the Redis documentation: [FT.ALIASDEL]: (https://redis.io/commands/ft.aliasdel/)

func (ClusterClient) FTAliasList added in v9.22.0

func (c ClusterClient) FTAliasList(ctx context.Context, index string) *StringSliceCmd

FTAliasList - Lists all aliases associated with an index. The 'index' parameter specifies the index whose aliases are listed; it must be the name of an index created with FT.CREATE, not an alias. The reply is an unordered collection of alias names, already deduplicated by the server; an index with no aliases yields an empty result, not an error. Available since Redis 8.10. For more information, please refer to the Redis documentation: [FT.ALIASLIST]: (https://redis.io/commands/ft.aliaslist/)

func (ClusterClient) FTAliasUpdate added in v9.5.4

func (c ClusterClient) FTAliasUpdate(ctx context.Context, index string, alias string) *StatusCmd

FTAliasUpdate - Updates an alias to an index. The 'index' parameter specifies the index to which the alias is updated, and the 'alias' parameter specifies the alias. If the alias already exists for a different index, it updates the alias to point to the specified index instead. For more information, please refer to the Redis documentation: [FT.ALIASUPDATE]: (https://redis.io/commands/ft.aliasupdate/)

func (ClusterClient) FTAlter added in v9.5.4

func (c ClusterClient) FTAlter(ctx context.Context, index string, skipInitialScan bool, definition []interface{}) *StatusCmd

FTAlter - Alters the definition of an existing index. The 'index' parameter specifies the index to alter, and the 'skipInitialScan' parameter specifies whether to skip the initial scan. The 'definition' parameter specifies the new definition for the index. For more information, please refer to the Redis documentation: [FT.ALTER]: (https://redis.io/commands/ft.alter/)

func (ClusterClient) FTConfigGet deprecated added in v9.5.4

func (c ClusterClient) FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd

Retrieves the value of a RediSearch configuration parameter. The 'option' parameter specifies the configuration parameter to retrieve. For more information, please refer to the Redis FT.CONFIG GET documentation.

Deprecated: FTConfigGet is deprecated in Redis 8. All configuration will be done with the CONFIG GET command. For more information check Client.ConfigGet and CONFIG GET Documentation

func (ClusterClient) FTConfigSet deprecated added in v9.5.4

func (c ClusterClient) FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd

Sets the value of a RediSearch configuration parameter. The 'option' parameter specifies the configuration parameter to set, and the 'value' parameter specifies the new value. For more information, please refer to the Redis FT.CONFIG SET documentation.

Deprecated: FTConfigSet is deprecated in Redis 8. All configuration will be done with the CONFIG SET command. For more information check Client.ConfigSet and CONFIG SET Documentation

func (ClusterClient) FTCreate added in v9.5.4

func (c ClusterClient) FTCreate(ctx context.Context, index string, options *FTCreateOptions, schema ...*FieldSchema) *StatusCmd

FTCreate - Creates a new index with the given options and schema. The 'index' parameter specifies the name of the index to create. The 'options' parameter specifies various options for the index, such as: whether to index hashes or JSONs, prefixes, filters, default language, score, score field, payload field, etc. The 'schema' parameter specifies the schema for the index, which includes the field name, field type, etc. For more information, please refer to the Redis documentation: [FT.CREATE]: (https://redis.io/commands/ft.create/)

func (ClusterClient) FTCursorDel added in v9.5.4

func (c ClusterClient) FTCursorDel(ctx context.Context, index string, cursorId int) *StatusCmd

FTCursorDel - Deletes a cursor from an existing index. The 'index' parameter specifies the index from which to delete the cursor, and the 'cursorId' parameter specifies the ID of the cursor to delete. For more information, please refer to the Redis documentation: [FT.CURSOR DEL]: (https://redis.io/commands/ft.cursor-del/)

func (ClusterClient) FTCursorRead added in v9.5.4

func (c ClusterClient) FTCursorRead(ctx context.Context, index string, cursorId int, count int) *MapStringInterfaceCmd

FTCursorRead - Reads the next results from an existing cursor. The 'index' parameter specifies the index from which to read the cursor, the 'cursorId' parameter specifies the ID of the cursor to read, and the 'count' parameter specifies the number of results to read. For more information, please refer to the Redis documentation: [FT.CURSOR READ]: (https://redis.io/commands/ft.cursor-read/)

func (ClusterClient) FTDictAdd added in v9.5.4

func (c ClusterClient) FTDictAdd(ctx context.Context, dict string, term ...interface{}) *IntCmd

FTDictAdd - Adds terms to a dictionary. The 'dict' parameter specifies the dictionary to which to add the terms, and the 'term' parameter specifies the terms to add. For more information, please refer to the Redis documentation: [FT.DICTADD]: (https://redis.io/commands/ft.dictadd/)

func (ClusterClient) FTDictDel added in v9.5.4

func (c ClusterClient) FTDictDel(ctx context.Context, dict string, term ...interface{}) *IntCmd

FTDictDel - Deletes terms from a dictionary. The 'dict' parameter specifies the dictionary from which to delete the terms, and the 'term' parameter specifies the terms to delete. For more information, please refer to the Redis documentation: [FT.DICTDEL]: (https://redis.io/commands/ft.dictdel/)

func (ClusterClient) FTDictDump added in v9.5.4

func (c ClusterClient) FTDictDump(ctx context.Context, dict string) *StringSliceCmd

FTDictDump - Returns all terms in the specified dictionary. The 'dict' parameter specifies the dictionary from which to return the terms. For more information, please refer to the Redis documentation: [FT.DICTDUMP]: (https://redis.io/commands/ft.dictdump/)

func (ClusterClient) FTDropIndex added in v9.5.4

func (c ClusterClient) FTDropIndex(ctx context.Context, index string) *StatusCmd

FTDropIndex - Deletes an index. The 'index' parameter specifies the index to delete. For more information, please refer to the Redis documentation: [FT.DROPINDEX]: (https://redis.io/commands/ft.dropindex/)

func (ClusterClient) FTDropIndexWithArgs added in v9.5.4

func (c ClusterClient) FTDropIndexWithArgs(ctx context.Context, index string, options *FTDropIndexOptions) *StatusCmd

FTDropIndexWithArgs - Deletes an index with options. The 'index' parameter specifies the index to delete, and the 'options' parameter specifies the DeleteDocs option for docs deletion. For more information, please refer to the Redis documentation: [FT.DROPINDEX]: (https://redis.io/commands/ft.dropindex/)

func (ClusterClient) FTExplain added in v9.5.4

func (c ClusterClient) FTExplain(ctx context.Context, index string, query string) *StringCmd

FTExplain - Returns the execution plan for a complex query. The 'index' parameter specifies the index to query, and the 'query' parameter specifies the query string. For more information, please refer to the Redis documentation: [FT.EXPLAIN]: (https://redis.io/commands/ft.explain/)

func (ClusterClient) FTExplainCli added in v9.5.4

func (c ClusterClient) FTExplainCli(ctx context.Context, key, path string) error

FTExplainCli - Returns the execution plan for a complex query. [Not Implemented] For more information, see https://redis.io/commands/ft.explaincli/

func (ClusterClient) FTExplainWithArgs added in v9.5.4

func (c ClusterClient) FTExplainWithArgs(ctx context.Context, index string, query string, options *FTExplainOptions) *StringCmd

FTExplainWithArgs - Returns the execution plan for a complex query with options. The 'index' parameter specifies the index to query, the 'query' parameter specifies the query string, and the 'options' parameter specifies the Dialect for the query. For more information, please refer to the Redis documentation: [FT.EXPLAIN]: (https://redis.io/commands/ft.explain/)

func (ClusterClient) FTHybrid added in v9.17.0

func (c ClusterClient) FTHybrid(ctx context.Context, index string, searchExpr string, vectorField string, vectorData Vector) *FTHybridCmd

FTHybrid - Executes a hybrid search combining full-text search and vector similarity The 'index' parameter specifies the index to search, 'searchExpr' is the search query, 'vectorField' is the name of the vector field, and 'vectorData' is the vector to search with. FTHybrid is still experimental, the command behaviour and signature may change

func (ClusterClient) FTHybridWithArgs added in v9.17.0

func (c ClusterClient) FTHybridWithArgs(ctx context.Context, index string, options *FTHybridOptions) *FTHybridCmd

FTHybridWithArgs - Executes a hybrid search with advanced options FTHybridWithArgs is still experimental, the command behaviour and signature may change

Vector data is always sent through the PARAMS mechanism, because inline vector blobs are no longer supported by Redis. For every vector expression whose VectorParamName is empty, a unique name is generated (e.g. "__vector_param_0") and the corresponding blob is passed via PARAMS.

options.Params is never mutated: the command is built from a local copy that combines the caller-provided params with any generated vector parameters. This makes it safe to reuse the same *FTHybridOptions across multiple calls. Generated names are also reserved against all explicit VectorParamName values, so they never collide with explicit names (even those following the "__vector_param_N" pattern).

func (ClusterClient) FTInfo added in v9.5.4

func (c ClusterClient) FTInfo(ctx context.Context, index string) *FTInfoCmd

FTInfo - Retrieves information about an index. The 'index' parameter specifies the index to retrieve information about. For more information, please refer to the Redis documentation: [FT.INFO]: (https://redis.io/commands/ft.info/)

func (ClusterClient) FTSearch added in v9.5.4

func (c ClusterClient) FTSearch(ctx context.Context, index string, query string) *FTSearchCmd

FTSearch - Executes a search query on an index. The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query. For more information, please refer to the Redis documentation about [FT.SEARCH].

[FT.SEARCH]: (https://redis.io/commands/ft.search/)

func (ClusterClient) FTSearchWithArgs added in v9.5.4

func (c ClusterClient) FTSearchWithArgs(ctx context.Context, index string, query string, options *FTSearchOptions) *FTSearchCmd

FTSearchWithArgs - Executes a search query on an index with additional options. The 'index' parameter specifies the index to search, the 'query' parameter specifies the search query, and the 'options' parameter specifies additional options for the search. For more information, please refer to the Redis documentation about [FT.SEARCH].

[FT.SEARCH]: (https://redis.io/commands/ft.search/)

func (ClusterClient) FTSpellCheck added in v9.5.4

func (c ClusterClient) FTSpellCheck(ctx context.Context, index string, query string) *FTSpellCheckCmd

FTSpellCheck - Checks a query string for spelling errors. For more details about spellcheck query please follow: https://redis.io/docs/interact/search-and-query/advanced-concepts/spellcheck/ For more information, please refer to the Redis documentation: [FT.SPELLCHECK]: (https://redis.io/commands/ft.spellcheck/)

func (ClusterClient) FTSpellCheckWithArgs added in v9.5.4

func (c ClusterClient) FTSpellCheckWithArgs(ctx context.Context, index string, query string, options *FTSpellCheckOptions) *FTSpellCheckCmd

FTSpellCheckWithArgs - Checks a query string for spelling errors with additional options. For more details about spellcheck query please follow: https://redis.io/docs/interact/search-and-query/advanced-concepts/spellcheck/ For more information, please refer to the Redis documentation: [FT.SPELLCHECK]: (https://redis.io/commands/ft.spellcheck/)

func (ClusterClient) FTSynDump added in v9.5.4

func (c ClusterClient) FTSynDump(ctx context.Context, index string) *FTSynDumpCmd

FTSynDump - Dumps the contents of a synonym group. The 'index' parameter specifies the index to dump. For more information, please refer to the Redis documentation: [FT.SYNDUMP]: (https://redis.io/commands/ft.syndump/)

func (ClusterClient) FTSynUpdate added in v9.5.4

func (c ClusterClient) FTSynUpdate(ctx context.Context, index string, synGroupId interface{}, terms []interface{}) *StatusCmd

FTSynUpdate - Creates or updates a synonym group with additional terms. The 'index' parameter specifies the index to update, the 'synGroupId' parameter specifies the synonym group id, and the 'terms' parameter specifies the additional terms. For more information, please refer to the Redis documentation: [FT.SYNUPDATE]: (https://redis.io/commands/ft.synupdate/)

func (ClusterClient) FTSynUpdateWithArgs added in v9.5.4

func (c ClusterClient) FTSynUpdateWithArgs(ctx context.Context, index string, synGroupId interface{}, options *FTSynUpdateOptions, terms []interface{}) *StatusCmd

FTSynUpdateWithArgs - Creates or updates a synonym group with additional terms and options. The 'index' parameter specifies the index to update, the 'synGroupId' parameter specifies the synonym group id, the 'options' parameter specifies additional options for the update, and the 'terms' parameter specifies the additional terms. For more information, please refer to the Redis documentation: [FT.SYNUPDATE]: (https://redis.io/commands/ft.synupdate/)

func (ClusterClient) FTTagVals added in v9.5.4

func (c ClusterClient) FTTagVals(ctx context.Context, index string, field string) *StringSliceCmd

FTTagVals - Returns all distinct values indexed in a tag field. The 'index' parameter specifies the index to check, and the 'field' parameter specifies the tag field to retrieve values from. For more information, please refer to the Redis documentation: [FT.TAGVALS]: (https://redis.io/commands/ft.tagvals/)

func (ClusterClient) FT_List added in v9.5.4

func (c ClusterClient) FT_List(ctx context.Context) *StringSliceCmd

FT_List - Lists all the existing indexes in the database. For more information, please refer to the Redis documentation: [FT._LIST]: (https://redis.io/commands/ft._list/)

func (ClusterClient) FlushAll

func (c ClusterClient) FlushAll(ctx context.Context) *StatusCmd

func (ClusterClient) FlushAllAsync

func (c ClusterClient) FlushAllAsync(ctx context.Context) *StatusCmd

func (ClusterClient) FlushDB

func (c ClusterClient) FlushDB(ctx context.Context) *StatusCmd

func (ClusterClient) FlushDBAsync

func (c ClusterClient) FlushDBAsync(ctx context.Context) *StatusCmd

func (*ClusterClient) ForEachMaster

func (c *ClusterClient) ForEachMaster(
	ctx context.Context,
	fn func(ctx context.Context, client *Client) error,
) error

ForEachMaster concurrently calls the fn on each master node in the cluster. It returns the first error if any.

func (*ClusterClient) ForEachShard

func (c *ClusterClient) ForEachShard(
	ctx context.Context,
	fn func(ctx context.Context, client *Client) error,
) error

ForEachShard concurrently calls the fn on each known node in the cluster. It returns the first error if any.

func (*ClusterClient) ForEachSlave

func (c *ClusterClient) ForEachSlave(
	ctx context.Context,
	fn func(ctx context.Context, client *Client) error,
) error

ForEachSlave concurrently calls the fn on each slave node in the cluster. It returns the first error if any.

func (ClusterClient) FunctionDelete added in v9.0.3

func (c ClusterClient) FunctionDelete(ctx context.Context, libName string) *StringCmd

func (ClusterClient) FunctionDump added in v9.0.3

func (c ClusterClient) FunctionDump(ctx context.Context) *StringCmd

func (ClusterClient) FunctionFlush added in v9.0.3

func (c ClusterClient) FunctionFlush(ctx context.Context) *StringCmd

func (ClusterClient) FunctionFlushAsync added in v9.0.3

func (c ClusterClient) FunctionFlushAsync(ctx context.Context) *StringCmd

func (ClusterClient) FunctionKill added in v9.0.3

func (c ClusterClient) FunctionKill(ctx context.Context) *StringCmd

func (ClusterClient) FunctionList added in v9.0.3

func (c ClusterClient) FunctionList(ctx context.Context, q FunctionListQuery) *FunctionListCmd

func (ClusterClient) FunctionLoad added in v9.0.3

func (c ClusterClient) FunctionLoad(ctx context.Context, code string) *StringCmd

func (ClusterClient) FunctionLoadReplace added in v9.0.3

func (c ClusterClient) FunctionLoadReplace(ctx context.Context, code string) *StringCmd

func (ClusterClient) FunctionRestore added in v9.0.3

func (c ClusterClient) FunctionRestore(ctx context.Context, libDump string) *StringCmd

func (ClusterClient) FunctionStats added in v9.0.3

func (c ClusterClient) FunctionStats(ctx context.Context) *FunctionStatsCmd

func (ClusterClient) GeoAdd

func (c ClusterClient) GeoAdd(ctx context.Context, key string, geoLocation ...*GeoLocation) *IntCmd

func (ClusterClient) GeoDist

func (c ClusterClient) GeoDist(
	ctx context.Context, key string, member1, member2, unit string,
) *FloatCmd

func (ClusterClient) GeoHash

func (c ClusterClient) GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd

func (ClusterClient) GeoPos

func (c ClusterClient) GeoPos(ctx context.Context, key string, members ...string) *GeoPosCmd

func (ClusterClient) GeoRadius deprecated

func (c ClusterClient) GeoRadius(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd

GeoRadius queries a geospatial index for members within a distance from a coordinate. This is a read-only variant that does not support Store or StoreDist options.

Deprecated: Use GeoSearch with BYRADIUS argument instead as of Redis 6.2.0.

func (ClusterClient) GeoRadiusByMember deprecated

func (c ClusterClient) GeoRadiusByMember(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd

GeoRadiusByMember queries a geospatial index for members within a distance from a member. This is a read-only variant that does not support Store or StoreDist options.

Deprecated: Use GeoSearch with BYRADIUS and FROMMEMBER arguments instead as of Redis 6.2.0.

func (ClusterClient) GeoRadiusByMemberStore

func (c ClusterClient) GeoRadiusByMemberStore(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (ClusterClient) GeoRadiusStore

func (c ClusterClient) GeoRadiusStore(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (ClusterClient) GeoSearch

func (c ClusterClient) GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd

func (ClusterClient) GeoSearchLocation

func (c ClusterClient) GeoSearchLocation(
	ctx context.Context, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd

func (ClusterClient) GeoSearchStore

func (c ClusterClient) GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd

func (ClusterClient) Get

func (c ClusterClient) Get(ctx context.Context, key string) *StringCmd

Get Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (ClusterClient) GetBit

func (c ClusterClient) GetBit(ctx context.Context, key string, offset int64) *IntCmd

func (ClusterClient) GetDel

func (c ClusterClient) GetDel(ctx context.Context, key string) *StringCmd

GetDel redis-server version >= 6.2.0.

func (ClusterClient) GetEx

func (c ClusterClient) GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.

func (ClusterClient) GetRange

func (c ClusterClient) GetRange(ctx context.Context, key string, start, end int64) *StringCmd

func (*ClusterClient) GetResolver added in v9.18.0

func (c *ClusterClient) GetResolver() *commandInfoResolver

func (ClusterClient) GetSet deprecated

func (c ClusterClient) GetSet(ctx context.Context, key string, value interface{}) *StringCmd

GetSet returns the old value stored at key and sets it to the new value.

Deprecated: Use SetArgs with Get option instead as of Redis 6.2.0.

func (ClusterClient) GetToBuffer added in v9.21.0

func (c ClusterClient) GetToBuffer(ctx context.Context, key string, buf []byte) *ZeroCopyStringCmd

GetToBuffer executes GET and reads the reply directly into buf, avoiding the intermediate string allocation that *StringCmd would produce. For values larger than the connection's read buffer, the payload is read straight from the socket into buf — effectively zero-copy on the receive path.

The returned *ZeroCopyStringCmd reports the number of bytes read via Val(), the populated slice via Bytes() (which is buf[:Val()]), and any error (including redis.Nil when the key does not exist) via Err(). If buf is too small to hold the value, Err() returns a "buffer too small" error.

Nothing is ever written past len(buf). When len(buf) >= value length + 2, the read takes a fast path that pulls the payload and the protocol's trailing CRLF in a single socket read, using the two bytes after the payload as scratch — size buffers with 2 spare bytes to opt in (see example/zerocopy-buffer).

This command opts out of automatic retries because partial data from a failed attempt would already be sitting in the caller's buffer.

func (ClusterClient) HDel

func (c ClusterClient) HDel(ctx context.Context, key string, fields ...string) *IntCmd

func (ClusterClient) HExists

func (c ClusterClient) HExists(ctx context.Context, key, field string) *BoolCmd

func (ClusterClient) HExpire added in v9.5.4

func (c ClusterClient) HExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd

HExpire - Sets the expiration time for specified fields in a hash in seconds. The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HEXPIRE Documentation.

func (ClusterClient) HExpireAt added in v9.5.4

func (c ClusterClient) HExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd

HExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in seconds. Takes a key, a UNIX timestamp, a struct of conditional flags, and a list of fields. The command sets absolute expiration times based on the UNIX timestamp provided. Available since Redis 7.4 CE. For more information refer to HExpireAt Documentation.

func (ClusterClient) HExpireAtWithArgs added in v9.5.4

func (c ClusterClient) HExpireAtWithArgs(ctx context.Context, key string, tm time.Time, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

func (ClusterClient) HExpireTime added in v9.5.4

func (c ClusterClient) HExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd

HExpireTime - Retrieves the expiration time for specified fields in a hash as a UNIX timestamp in seconds. Requires a key and the fields themselves to fetch their expiration timestamps. This command returns the expiration times for each field or error/status codes for each field as specified. Available since Redis 7.4 CE. For more information refer to [HExpireTime Documentation].

[HExpireTime Documentation]: https://redis.io/commands/hexpiretime/ For more information - https://redis.io/commands/hexpiretime/

func (ClusterClient) HExpireWithArgs added in v9.5.4

func (c ClusterClient) HExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

HExpireWithArgs - Sets the expiration time for specified fields in a hash in seconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HEXPIRE Documentation.

func (ClusterClient) HGet

func (c ClusterClient) HGet(ctx context.Context, key, field string) *StringCmd

func (ClusterClient) HGetAll

func (c ClusterClient) HGetAll(ctx context.Context, key string) *MapStringStringCmd

HGetAll returns a map of all fields and values stored at key.

Returns an empty map when key does not exist.

Time complexity: O(N) where N is the size of the hash.

See https://redis.io/commands/hgetall/

func (ClusterClient) HGetDel added in v9.8.0

func (c ClusterClient) HGetDel(ctx context.Context, key string, fields ...string) *StringSliceCmd

func (ClusterClient) HGetEX added in v9.8.0

func (c ClusterClient) HGetEX(ctx context.Context, key string, fields ...string) *StringSliceCmd

func (ClusterClient) HGetEXWithArgs added in v9.8.0

func (c ClusterClient) HGetEXWithArgs(ctx context.Context, key string, options *HGetEXOptions, fields ...string) *StringSliceCmd

func (*ClusterClient) HImportDiscard added in v9.22.0

func (c *ClusterClient) HImportDiscard(ctx context.Context, fieldsetName string) *IntCmd

HImportDiscard removes the fieldset from the cluster-wide registry and discards it on every master; connections the fan-out does not reach replay the discard before their next HIMPORT command. It returns 1 if the fieldset was registered on this client and is now removed.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (*ClusterClient) HImportDiscardAll added in v9.22.0

func (c *ClusterClient) HImportDiscardAll(ctx context.Context) *IntCmd

HImportDiscardAll removes all fieldsets from the cluster-wide registry and wipes them on every master; connections the fan-out does not reach replay the wipe before their next HIMPORT command. It returns the number of fieldsets removed from the registry.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (*ClusterClient) HImportPrepare added in v9.22.0

func (c *ClusterClient) HImportPrepare(ctx context.Context, fieldsetName string, fields ...string) *StatusCmd

HImportPrepare registers the fieldset in the cluster-wide registry and eagerly prepares one connection on every master; all other connections — including those of replicas promoted later and masters added by resharding — are prepared lazily before their first HImportSet. See HashCmdable.HImportPrepare (cmdable) for the fieldset semantics.

The fan-out is best-effort and reports the first error: on a server rejection (e.g. duplicate field name) the registration is withdrawn and any sessions the fan-out already prepared are cleaned lazily; on a transport failure the registration is kept and lazy replay covers the connections the fan-out missed.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (ClusterClient) HImportSet added in v9.22.0

func (c ClusterClient) HImportSet(ctx context.Context, key, fieldsetName string, values ...interface{}) *StatusCmd

HImportSet creates or fully replaces the hash at key using the field list registered under fieldsetName, pairing values positionally with the prepared fields:

HIMPORT SET key fieldset_name value [value ...]

The number of values must equal the fieldset's field count. The resulting key is a regular hash readable and writable by all hash commands. If the fieldset was registered through HImportPrepare on this client, it is prepared automatically on whichever pooled connection executes the command; otherwise the fieldset must have been prepared on the executing connection or the server replies "ERR no such fieldset".

"no such fieldset" never surfaces for a registered fieldset: a single-command HImportSet whose connection lost its session state (e.g. RESET) is transparently re-prepared and retried once — the failure also stales every other connection's prepared flag, so the retry re-prepares wherever it lands, and this recovery attempt is granted even when retries are disabled (MaxRetries -1). In pipelines the failed HImportSets — and only those — are re-prepared and re-issued once on the same connection (HIMPORT SET is a full replace, so the re-execution is idempotent and no other command of the batch runs again). Inside transactions the error does surface after EXEC — an executed transaction cannot be partially re-run — but the prepared flags are invalidated, so retrying the transaction succeeds.

Requires Redis 8.10 or newer.

note: the API is experimental and may be subject to change.

func (ClusterClient) HIncrBy

func (c ClusterClient) HIncrBy(ctx context.Context, key, field string, incr int64) *IntCmd

func (ClusterClient) HIncrByFloat

func (c ClusterClient) HIncrByFloat(ctx context.Context, key, field string, incr float64) *FloatCmd

func (ClusterClient) HKeys

func (c ClusterClient) HKeys(ctx context.Context, key string) *StringSliceCmd

func (ClusterClient) HLen

func (c ClusterClient) HLen(ctx context.Context, key string) *IntCmd

func (ClusterClient) HMGet

func (c ClusterClient) HMGet(ctx context.Context, key string, fields ...string) *SliceCmd

HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.

func (ClusterClient) HMSet

func (c ClusterClient) HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (ClusterClient) HPExpire added in v9.5.4

func (c ClusterClient) HPExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd

HPExpire - Sets the expiration time for specified fields in a hash in milliseconds. Similar to HExpire, it accepts a key, an expiration duration in milliseconds, a struct with expiration condition flags, and a list of fields. The command modifies the standard time.Duration to milliseconds for the Redis command. Available since Redis 7.4 CE. For more information refer to HPEXPIRE Documentation.

func (ClusterClient) HPExpireAt added in v9.5.4

func (c ClusterClient) HPExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd

HPExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in milliseconds. Similar to HExpireAt but for timestamps in milliseconds. It accepts the same parameters and adjusts the UNIX time to milliseconds. Available since Redis 7.4 CE. For more information refer to HExpireAt Documentation.

func (ClusterClient) HPExpireAtWithArgs added in v9.5.4

func (c ClusterClient) HPExpireAtWithArgs(ctx context.Context, key string, tm time.Time, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

func (ClusterClient) HPExpireTime added in v9.5.4

func (c ClusterClient) HPExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPExpireTime - Retrieves the expiration time for specified fields in a hash as a UNIX timestamp in milliseconds. Similar to HExpireTime, adjusted for timestamps in milliseconds. It requires the same parameters. Provides the expiration timestamp for each field in milliseconds. Available since Redis 7.4 CE. For more information refer to [HExpireTime Documentation].

[HExpireTime Documentation]: https://redis.io/commands/hexpiretime/ For more information - https://redis.io/commands/hexpiretime/

func (ClusterClient) HPExpireWithArgs added in v9.5.4

func (c ClusterClient) HPExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd

HPExpireWithArgs - Sets the expiration time for specified fields in a hash in milliseconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HPEXPIRE", followed by the key, duration, any conditional flags, and the specified fields. Available since Redis 7.4 CE. For more information refer to HPEXPIRE Documentation.

func (ClusterClient) HPTTL added in v9.5.4

func (c ClusterClient) HPTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPTTL - Retrieves the remaining time to live for specified fields in a hash in milliseconds. Similar to HTTL, but returns the TTL in milliseconds. It requires a key and the specified fields. This command provides the TTL in milliseconds for each field or returns error/status codes as needed. Available since Redis 7.4 CE. For more information refer to [HPTTL Documentation].

[HPTTL Documentation]: https://redis.io/commands/hpttl/ For more information - https://redis.io/commands/hpttl/

func (ClusterClient) HPersist added in v9.5.4

func (c ClusterClient) HPersist(ctx context.Context, key string, fields ...string) *IntSliceCmd

HPersist - Removes the expiration time from specified fields in a hash. Accepts a key and the fields themselves. This command ensures that each field specified will have its expiration removed if present. Available since Redis 7.4 CE. For more information refer to HPersist Documentation.

func (ClusterClient) HRandField

func (c ClusterClient) HRandField(ctx context.Context, key string, count int) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (ClusterClient) HRandFieldWithValues

func (c ClusterClient) HRandFieldWithValues(ctx context.Context, key string, count int) *KeyValueSliceCmd

HRandFieldWithValues redis-server version >= 6.2.0.

func (ClusterClient) HScan

func (c ClusterClient) HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (ClusterClient) HScanNoValues added in v9.5.4

func (c ClusterClient) HScanNoValues(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

func (ClusterClient) HSet

func (c ClusterClient) HSet(ctx context.Context, key string, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet(ctx, "myhash", "key1", "value1", "key2", "value2")

  • HSet(ctx, "myhash", []string{"key1", "value1", "key2", "value2"})

  • HSet(ctx, "myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

    Playing struct With "redis" tag. type MyHash struct { Key1 string `redis:"key1"`; Key2 int `redis:"key2"` }

  • HSet(ctx, "myhash", MyHash{"value1", "value2"}) Warn: redis-server >= 4.0

    For struct, can be a structure pointer type, we only parse the field whose tag is redis. if you don't want the field to be read, you can use the `redis:"-"` flag to ignore it, or you don't need to set the redis tag. For the type of structure field, we only support simple data types: string, int/uint(8,16,32,64), float(32,64), time.Time(to RFC3339Nano), time.Duration(to Nanoseconds ), if you are other more complex or custom data types, please implement the encoding.BinaryMarshaler interface.

Note that in older versions of Redis server(redis-server < 4.0), HSet only supports a single key-value pair. redis-docs: https://redis.io/commands/hset (Starting with Redis version 4.0.0: Accepts multiple field and value arguments.) If you are using a Struct type and the number of fields is greater than one, you will receive an error similar to "ERR wrong number of arguments", you can use HMSet as a substitute.

func (ClusterClient) HSetEX added in v9.8.0

func (c ClusterClient) HSetEX(ctx context.Context, key string, fieldsAndValues ...string) *IntCmd

func (ClusterClient) HSetEXWithArgs added in v9.8.0

func (c ClusterClient) HSetEXWithArgs(ctx context.Context, key string, options *HSetEXOptions, fieldsAndValues ...string) *IntCmd

func (ClusterClient) HSetNX

func (c ClusterClient) HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd

func (ClusterClient) HStrLen added in v9.8.0

func (c ClusterClient) HStrLen(ctx context.Context, key, field string) *IntCmd

func (ClusterClient) HTTL added in v9.5.4

func (c ClusterClient) HTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd

HTTL - Retrieves the remaining time to live for specified fields in a hash in seconds. Requires a key and the fields themselves. It returns the TTL for each specified field. This command fetches the TTL in seconds for each field or returns error/status codes as appropriate. Available since Redis 7.4 CE. For more information refer to HTTL Documentation.

func (ClusterClient) HVals

func (c ClusterClient) HVals(ctx context.Context, key string) *StringSliceCmd

func (ClusterClient) Incr

func (c ClusterClient) Incr(ctx context.Context, key string) *IntCmd

func (ClusterClient) IncrBy

func (c ClusterClient) IncrBy(ctx context.Context, key string, value int64) *IntCmd

func (ClusterClient) IncrByFloat

func (c ClusterClient) IncrByFloat(ctx context.Context, key string, value float64) *FloatCmd

func (ClusterClient) IncrEXFloat added in v9.20.0

func (c ClusterClient) IncrEXFloat(ctx context.Context, key string, a IncrEXFloatArgs) *IncrEXFloatCmd

IncrEXFloat Redis `INCREX key [BYFLOAT amount] [LBOUND value] [UBOUND value] [SATURATE] [EX seconds | PX ms | EXAT ts | PXAT ts | PERSIST] [ENX]` command.

Available since Redis 8.8. For more information, see https://redis.io/commands/increx

func (ClusterClient) IncrEXInt added in v9.20.0

func (c ClusterClient) IncrEXInt(ctx context.Context, key string, a IncrEXIntArgs) *IncrEXIntCmd

IncrEXInt Redis `INCREX key [BYINT amount] [LBOUND value] [UBOUND value] [SATURATE] [EX seconds | PX ms | EXAT ts | PXAT ts | PERSIST] [ENX]` command.

Atomically increments the integer value stored at key, optionally constraining the result to a range and applying expiration semantics. Returns the new value and the increment that was actually applied. When the increment would exceed LBOUND/UBOUND and SATURATE is not set, the key and TTL are left unchanged and the reply is [current_value, 0].

Available since Redis 8.8. For more information, see https://redis.io/commands/increx

func (ClusterClient) Info

func (c ClusterClient) Info(ctx context.Context, sections ...string) *StringCmd

func (ClusterClient) InfoMap added in v9.3.0

func (c ClusterClient) InfoMap(ctx context.Context, sections ...string) *InfoCmd

func (ClusterClient) JSONArrAppend added in v9.3.0

func (c ClusterClient) JSONArrAppend(ctx context.Context, key, path string, values ...interface{}) *IntSliceCmd

JSONArrAppend adds the provided JSON values to the end of the array at the given path. For more information, see https://redis.io/commands/json.arrappend

func (ClusterClient) JSONArrIndex added in v9.3.0

func (c ClusterClient) JSONArrIndex(ctx context.Context, key, path string, value ...interface{}) *IntSliceCmd

JSONArrIndex searches for the first occurrence of the provided JSON value in the array at the given path. For more information, see https://redis.io/commands/json.arrindex

func (ClusterClient) JSONArrIndexWithArgs added in v9.3.0

func (c ClusterClient) JSONArrIndexWithArgs(ctx context.Context, key, path string, options *JSONArrIndexArgs, value ...interface{}) *IntSliceCmd

JSONArrIndexWithArgs searches for the first occurrence of a JSON value in an array while allowing the start and stop options to be provided. For more information, see https://redis.io/commands/json.arrindex

func (ClusterClient) JSONArrInsert added in v9.3.0

func (c ClusterClient) JSONArrInsert(ctx context.Context, key, path string, index int64, values ...interface{}) *IntSliceCmd

JSONArrInsert inserts the JSON values into the array at the specified path before the index (shifts to the right). For more information, see https://redis.io/commands/json.arrinsert

func (ClusterClient) JSONArrLen added in v9.3.0

func (c ClusterClient) JSONArrLen(ctx context.Context, key, path string) *IntSliceCmd

JSONArrLen reports the length of the JSON array at the specified path in the given key. For more information, see https://redis.io/commands/json.arrlen

func (ClusterClient) JSONArrPop added in v9.3.0

func (c ClusterClient) JSONArrPop(ctx context.Context, key, path string, index int) *StringSliceCmd

JSONArrPop removes and returns an element from the specified index in the array. For more information, see https://redis.io/commands/json.arrpop

func (ClusterClient) JSONArrTrim added in v9.3.0

func (c ClusterClient) JSONArrTrim(ctx context.Context, key, path string) *IntSliceCmd

JSONArrTrim trims an array to contain only the specified inclusive range of elements. For more information, see https://redis.io/commands/json.arrtrim

func (ClusterClient) JSONArrTrimWithArgs added in v9.3.0

func (c ClusterClient) JSONArrTrimWithArgs(ctx context.Context, key, path string, options *JSONArrTrimArgs) *IntSliceCmd

JSONArrTrimWithArgs trims an array to contain only the specified inclusive range of elements. For more information, see https://redis.io/commands/json.arrtrim

func (ClusterClient) JSONClear added in v9.3.0

func (c ClusterClient) JSONClear(ctx context.Context, key, path string) *IntCmd

JSONClear clears container values (arrays/objects) and sets numeric values to 0. For more information, see https://redis.io/commands/json.clear

func (ClusterClient) JSONDebugMemory added in v9.3.0

func (c ClusterClient) JSONDebugMemory(ctx context.Context, key, path string) *IntCmd

JSONDebugMemory reports a value's memory usage in bytes (unimplemented) For more information, see https://redis.io/commands/json.debug-memory

func (ClusterClient) JSONDel added in v9.3.0

func (c ClusterClient) JSONDel(ctx context.Context, key, path string) *IntCmd

JSONDel deletes a value. For more information, see https://redis.io/commands/json.del

func (ClusterClient) JSONForget added in v9.3.0

func (c ClusterClient) JSONForget(ctx context.Context, key, path string) *IntCmd

JSONForget deletes a value. For more information, see https://redis.io/commands/json.forget

func (ClusterClient) JSONGet added in v9.3.0

func (c ClusterClient) JSONGet(ctx context.Context, key string, paths ...string) *JSONCmd

JSONGet returns the value at path in JSON serialized form. JSON.GET returns an array of strings. This function parses out the wrapping array but leaves the internal strings unprocessed by default (see Val()) For more information - https://redis.io/commands/json.get/

func (ClusterClient) JSONGetWithArgs added in v9.3.0

func (c ClusterClient) JSONGetWithArgs(ctx context.Context, key string, options *JSONGetArgs, paths ...string) *JSONCmd

JSONGetWithArgs - Retrieves the value of a key from a JSON document. This function also allows for specifying additional options such as: Indention, NewLine and Space For more information - https://redis.io/commands/json.get/

func (ClusterClient) JSONMGet added in v9.3.0

func (c ClusterClient) JSONMGet(ctx context.Context, path string, keys ...string) *JSONSliceCmd

JSONMGet returns the values at the specified path from multiple key arguments. Note - the arguments are reversed when compared with `JSON.MGET` as we want to follow the pattern of having the last argument be variable. For more information, see https://redis.io/commands/json.mget

func (ClusterClient) JSONMSet added in v9.3.0

func (c ClusterClient) JSONMSet(ctx context.Context, params ...interface{}) *StatusCmd

func (ClusterClient) JSONMSetArgs added in v9.3.0

func (c ClusterClient) JSONMSetArgs(ctx context.Context, docs []JSONSetArgs) *StatusCmd

JSONMSetArgs sets or updates one or more JSON values according to the specified key-path-value triplets. For more information, see https://redis.io/commands/json.mset

func (ClusterClient) JSONMerge added in v9.3.0

func (c ClusterClient) JSONMerge(ctx context.Context, key, path string, value string) *StatusCmd

JSONMerge merges a given JSON value into matching paths. For more information, see https://redis.io/commands/json.merge

func (ClusterClient) JSONNumIncrBy added in v9.3.0

func (c ClusterClient) JSONNumIncrBy(ctx context.Context, key, path string, value float64) *JSONCmd

JSONNumIncrBy increments the number value stored at the specified path by the provided number. For more information, see https://redis.io/docs/latest/commands/json.numincrby/

func (ClusterClient) JSONObjKeys added in v9.3.0

func (c ClusterClient) JSONObjKeys(ctx context.Context, key, path string) *SliceCmd

JSONObjKeys returns the keys in the object that's referenced by the specified path. For more information, see https://redis.io/commands/json.objkeys

func (ClusterClient) JSONObjLen added in v9.3.0

func (c ClusterClient) JSONObjLen(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONObjLen reports the number of keys in the JSON object at the specified path in the given key. For more information, see https://redis.io/commands/json.objlen

func (ClusterClient) JSONSet added in v9.3.0

func (c ClusterClient) JSONSet(ctx context.Context, key, path string, value interface{}) *StatusCmd

JSONSet sets the JSON value at the given path in the given key. The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or a []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (ClusterClient) JSONSetMode added in v9.3.0

func (c ClusterClient) JSONSetMode(ctx context.Context, key, path string, value interface{}, mode string) *StatusCmd

JSONSetMode sets the JSON value at the given path in the given key and allows the mode to be set (the mode value must be "XX" or "NX"). The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (ClusterClient) JSONSetWithArgs added in v9.20.0

func (c ClusterClient) JSONSetWithArgs(ctx context.Context, key, path string, value interface{}, options *JSONSetArgsOptions) *StatusCmd

JSONSetWithArgs sets the JSON value at the given path in the given key with optional arguments for setting mode (NX/XX) and the FPHA (Floating-Point Homogeneous Array) type used for storing FP arrays. The value must be something that can be marshaled to JSON (using encoding/JSON) unless the argument is a string or []byte when we assume that it can be passed directly as JSON. For more information, see https://redis.io/commands/json.set

func (ClusterClient) JSONStrAppend added in v9.3.0

func (c ClusterClient) JSONStrAppend(ctx context.Context, key, path, value string) *IntPointerSliceCmd

JSONStrAppend appends the JSON-string values to the string at the specified path. For more information, see https://redis.io/commands/json.strappend

func (ClusterClient) JSONStrLen added in v9.3.0

func (c ClusterClient) JSONStrLen(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONStrLen reports the length of the JSON String at the specified path in the given key. For more information, see https://redis.io/commands/json.strlen

func (ClusterClient) JSONToggle added in v9.3.0

func (c ClusterClient) JSONToggle(ctx context.Context, key, path string) *IntPointerSliceCmd

JSONToggle toggles a Boolean value stored at the specified path. For more information, see https://redis.io/commands/json.toggle

func (ClusterClient) JSONType added in v9.3.0

func (c ClusterClient) JSONType(ctx context.Context, key, path string) *JSONSliceCmd

JSONType reports the type of JSON value at the specified path. For more information, see https://redis.io/commands/json.type

func (ClusterClient) Keys

func (c ClusterClient) Keys(ctx context.Context, pattern string) *StringSliceCmd

func (ClusterClient) LCS added in v9.0.3

func (c ClusterClient) LCS(ctx context.Context, q *LCSQuery) *LCSCmd

func (ClusterClient) LIndex

func (c ClusterClient) LIndex(ctx context.Context, key string, index int64) *StringCmd

func (ClusterClient) LInsert

func (c ClusterClient) LInsert(ctx context.Context, key, op string, pivot, value interface{}) *IntCmd

func (ClusterClient) LInsertAfter

func (c ClusterClient) LInsertAfter(ctx context.Context, key string, pivot, value interface{}) *IntCmd

func (ClusterClient) LInsertBefore

func (c ClusterClient) LInsertBefore(ctx context.Context, key string, pivot, value interface{}) *IntCmd

func (ClusterClient) LLen

func (c ClusterClient) LLen(ctx context.Context, key string) *IntCmd

func (ClusterClient) LMPop added in v9.0.3

func (c ClusterClient) LMPop(ctx context.Context, direction string, count int64, keys ...string) *KeyValuesCmd

LMPop Pops one or more elements from the first non-empty list key from the list of provided key names. direction: left or right, count: > 0 example: client.LMPop(ctx, "left", 3, "key1", "key2")

func (ClusterClient) LMove

func (c ClusterClient) LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd

func (ClusterClient) LMoveM added in v9.22.0

func (c ClusterClient) LMoveM(ctx context.Context, source, destination, srcpos, destpos string, a LMoveMArgs) *StringSliceCmd

LMoveM atomically moves multiple elements between lists (Redis 8.10+). srcpos/destpos are "LEFT" or "RIGHT". Returns moved elements, or redis.Nil if none.

func (ClusterClient) LPop

func (c ClusterClient) LPop(ctx context.Context, key string) *StringCmd

func (ClusterClient) LPopCount

func (c ClusterClient) LPopCount(ctx context.Context, key string, count int) *StringSliceCmd

func (ClusterClient) LPos

func (c ClusterClient) LPos(ctx context.Context, key string, value string, a LPosArgs) *IntCmd

func (ClusterClient) LPosCount

func (c ClusterClient) LPosCount(ctx context.Context, key string, value string, count int64, a LPosArgs) *IntSliceCmd

func (ClusterClient) LPush

func (c ClusterClient) LPush(ctx context.Context, key string, values ...interface{}) *IntCmd

func (ClusterClient) LPushX

func (c ClusterClient) LPushX(ctx context.Context, key string, values ...interface{}) *IntCmd

func (ClusterClient) LRange

func (c ClusterClient) LRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd

func (ClusterClient) LRem

func (c ClusterClient) LRem(ctx context.Context, key string, count int64, value interface{}) *IntCmd

func (ClusterClient) LSet

func (c ClusterClient) LSet(ctx context.Context, key string, index int64, value interface{}) *StatusCmd

func (ClusterClient) LTrim

func (c ClusterClient) LTrim(ctx context.Context, key string, start, stop int64) *StatusCmd

func (ClusterClient) LastSave

func (c ClusterClient) LastSave(ctx context.Context) *IntCmd

func (ClusterClient) Latency added in v9.17.0

func (c ClusterClient) Latency(ctx context.Context) *LatencyCmd

func (ClusterClient) LatencyReset added in v9.17.0

func (c ClusterClient) LatencyReset(ctx context.Context, events ...interface{}) *StatusCmd

func (ClusterClient) MGet

func (c ClusterClient) MGet(ctx context.Context, keys ...string) *SliceCmd

func (ClusterClient) MSet

func (c ClusterClient) MSet(ctx context.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
  • MSet(struct), For struct types, see HSet description.

func (ClusterClient) MSetEX added in v9.17.0

func (c ClusterClient) MSetEX(ctx context.Context, args MSetEXArgs, values ...interface{}) *IntCmd

MSetEX sets the given keys to their respective values. This command is an extension of the MSETNX that adds expiration and XX options. Available since Redis 8.4 Important: When this method is used with Cluster clients, all keys must be in the same hash slot, otherwise CROSSSLOT error will be returned. For more information, see https://redis.io/commands/msetex

func (ClusterClient) MSetNX

func (c ClusterClient) MSetNX(ctx context.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
  • MSetNX(struct), For struct types, see HSet description.

func (*ClusterClient) MasterForKey

func (c *ClusterClient) MasterForKey(ctx context.Context, key string) (*Client, error)

MasterForKey return a client to the master node for a particular key.

func (ClusterClient) MemoryUsage

func (c ClusterClient) MemoryUsage(ctx context.Context, key string, samples ...int) *IntCmd

func (ClusterClient) Migrate

func (c ClusterClient) Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd

func (ClusterClient) ModuleLoadex added in v9.0.4

func (c ClusterClient) ModuleLoadex(ctx context.Context, conf *ModuleLoadexConfig) *StringCmd

ModuleLoadex Redis `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]` command.

func (ClusterClient) Monitor added in v9.3.1

func (c ClusterClient) Monitor(ctx context.Context, ch chan string) *MonitorCmd

Monitor - represents a Redis MONITOR command, allowing the user to capture and process all commands sent to a Redis server. This mimics the behavior of MONITOR in the redis-cli.

Notes: - Using MONITOR blocks the connection to the server for itself. It needs a dedicated connection - The user should create a channel of type string - This runs concurrently in the background. Trigger via the Start and Stop functions See further: Redis MONITOR command: https://redis.io/commands/monitor

func (ClusterClient) Move

func (c ClusterClient) Move(ctx context.Context, key string, db int) *BoolCmd

func (*ClusterClient) NewDynamicResolver added in v9.18.0

func (c *ClusterClient) NewDynamicResolver() *commandInfoResolver

NewDynamicResolver returns a CommandInfoResolver that uses the underlying cmdInfo cache to resolve the policies

func (ClusterClient) ObjectEncoding

func (c ClusterClient) ObjectEncoding(ctx context.Context, key string) *StringCmd

func (ClusterClient) ObjectFreq added in v9.5.0

func (c ClusterClient) ObjectFreq(ctx context.Context, key string) *IntCmd

func (ClusterClient) ObjectIdleTime

func (c ClusterClient) ObjectIdleTime(ctx context.Context, key string) *DurationCmd

func (ClusterClient) ObjectRefCount

func (c ClusterClient) ObjectRefCount(ctx context.Context, key string) *IntCmd

func (*ClusterClient) OnNewNode

func (c *ClusterClient) OnNewNode(fn func(rdb *Client))

func (*ClusterClient) Options

func (c *ClusterClient) Options() *ClusterOptions

Options returns read-only *ClusterOptions that were used to create the client. Any alteration of the returned *ClusterOptions may result in undefined behaviour.

func (ClusterClient) PExpire

func (c ClusterClient) PExpire(ctx context.Context, key string, expiration time.Duration) *BoolCmd

func (ClusterClient) PExpireAt

func (c ClusterClient) PExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd

func (ClusterClient) PExpireTime added in v9.0.3

func (c ClusterClient) PExpireTime(ctx context.Context, key string) *DurationCmd

PExpireTime returns the absolute expiration time of key as a Unix timestamp encoded in *DurationCmd (milliseconds since the epoch), not a remaining TTL. Convert with: time.UnixMilli(int64(d/time.Millisecond)). Use TTL/PTTL for remaining TTL.

func (ClusterClient) PFAdd

func (c ClusterClient) PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd

func (ClusterClient) PFCount

func (c ClusterClient) PFCount(ctx context.Context, keys ...string) *IntCmd

func (ClusterClient) PFMerge

func (c ClusterClient) PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd

func (*ClusterClient) PSubscribe

func (c *ClusterClient) PSubscribe(ctx context.Context, channels ...string) *PubSub

PSubscribe subscribes the client to the given patterns. Patterns can be omitted to create empty subscription.

func (ClusterClient) PTTL

func (c ClusterClient) PTTL(ctx context.Context, key string) *DurationCmd

func (ClusterClient) Persist

func (c ClusterClient) Persist(ctx context.Context, key string) *BoolCmd

func (ClusterClient) Ping

func (c ClusterClient) Ping(ctx context.Context) *StatusCmd

func (*ClusterClient) Pipeline

func (c *ClusterClient) Pipeline() Pipeliner

func (*ClusterClient) Pipelined

func (c *ClusterClient) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)

func (*ClusterClient) PoolStats

func (c *ClusterClient) PoolStats() *PoolStats

PoolStats returns accumulated connection pool stats.

func (*ClusterClient) Process

func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error

func (ClusterClient) PubSubChannels

func (c ClusterClient) PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd

func (ClusterClient) PubSubNumPat

func (c ClusterClient) PubSubNumPat(ctx context.Context) *IntCmd

func (ClusterClient) PubSubNumSub

func (c ClusterClient) PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd

func (ClusterClient) PubSubShardChannels

func (c ClusterClient) PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd

func (ClusterClient) PubSubShardNumSub

func (c ClusterClient) PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd

func (ClusterClient) Publish

func (c ClusterClient) Publish(ctx context.Context, channel string, message interface{}) *IntCmd

Publish posts the message to the channel.

func (ClusterClient) Quit deprecated

func (c ClusterClient) Quit(_ context.Context) *StatusCmd

Quit closes the connection.

Deprecated: Just close the connection instead as of Redis 7.2.0.

func (ClusterClient) RPop

func (c ClusterClient) RPop(ctx context.Context, key string) *StringCmd

func (ClusterClient) RPopCount

func (c ClusterClient) RPopCount(ctx context.Context, key string, count int) *StringSliceCmd

func (ClusterClient) RPopLPush deprecated

func (c ClusterClient) RPopLPush(ctx context.Context, source, destination string) *StringCmd

RPopLPush atomically returns and removes the last element of the source list, and pushes the element as the first element of the destination list.

Deprecated: Use LMove with RIGHT and LEFT arguments instead as of Redis 6.2.0.

func (ClusterClient) RPush

func (c ClusterClient) RPush(ctx context.Context, key string, values ...interface{}) *IntCmd

func (ClusterClient) RPushX

func (c ClusterClient) RPushX(ctx context.Context, key string, values ...interface{}) *IntCmd

func (ClusterClient) RandomKey

func (c ClusterClient) RandomKey(ctx context.Context) *StringCmd

func (ClusterClient) ReadOnly

func (c ClusterClient) ReadOnly(ctx context.Context) *StatusCmd

func (ClusterClient) ReadWrite

func (c ClusterClient) ReadWrite(ctx context.Context) *StatusCmd

func (*ClusterClient) ReloadState

func (c *ClusterClient) ReloadState(ctx context.Context)

ReloadState reloads cluster state. If available it calls ClusterSlots func to get cluster slots information.

func (ClusterClient) Rename

func (c ClusterClient) Rename(ctx context.Context, key, newkey string) *StatusCmd

func (ClusterClient) RenameNX

func (c ClusterClient) RenameNX(ctx context.Context, key, newkey string) *BoolCmd

func (ClusterClient) ReplicaOf added in v9.19.0

func (c ClusterClient) ReplicaOf(ctx context.Context, host, port string) *StatusCmd

ReplicaOf sets a Redis server as a replica of another, or promotes it to being a master.

func (ClusterClient) Restore

func (c ClusterClient) Restore(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd

func (ClusterClient) RestoreReplace

func (c ClusterClient) RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd

func (ClusterClient) SAdd

func (c ClusterClient) SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd

Returns the number of elements that were added to the set, not including all the elements already present in the set.

For more information about the command please refer to [SADD].

[SADD]: (https://redis.io/docs/latest/commands/sadd/)

func (ClusterClient) SCard

func (c ClusterClient) SCard(ctx context.Context, key string) *IntCmd

Returns the set cardinality (number of elements) of the set stored at key. Returns 0 if key does not exist.

For more information about the command please refer to [SCARD].

[SCARD]: (https://redis.io/docs/latest/commands/scard/)

func (ClusterClient) SDiff

func (c ClusterClient) SDiff(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the difference between the first set and all the successive sets. Keys that do not exist are considered to be empty sets.

For more information about the command please refer to [SDIFF].

[SDIFF]: (https://redis.io/docs/latest/commands/sdiff/)

func (ClusterClient) SDiffCard added in v9.22.0

func (c ClusterClient) SDiffCard(ctx context.Context, opts *SDiffCardOptions, keys ...string) *IntCmd

Returns the cardinality of the difference of the first set and the rest. Missing keys are treated as empty sets.

For more information about the command please refer to [SDIFFCARD].

[SDIFFCARD]: (https://redis.io/docs/latest/commands/sdiffcard/)

func (ClusterClient) SDiffStore

func (c ClusterClient) SDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the difference between the first set and all the successive sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SDIFFSTORE].

[SDIFFSTORE]: (https://redis.io/docs/latest/commands/sdiffstore/)

func (ClusterClient) SInter

func (c ClusterClient) SInter(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the intersection of all the given sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty.

For more information about the command please refer to [SINTER].

[SINTER]: (https://redis.io/docs/latest/commands/sinter/)

func (ClusterClient) SInterCard

func (c ClusterClient) SInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd

Returns the cardinality of the set resulting from the intersection of all the given sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty.

The limit parameter sets an upper bound on the number of results returned. If limit is 0, no limit is applied.

For more information about the command please refer to [SINTERCARD].

[SINTERCARD]: (https://redis.io/docs/latest/commands/sintercard/)

func (ClusterClient) SInterStore

func (c ClusterClient) SInterStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the intersection of all the given sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SINTERSTORE].

[SINTERSTORE]: (https://redis.io/docs/latest/commands/sinterstore/)

func (ClusterClient) SIsMember

func (c ClusterClient) SIsMember(ctx context.Context, key string, member interface{}) *BoolCmd

Returns if member is a member of the set stored at key. Returns true if the element is a member of the set, false if it is not a member or if key does not exist.

For more information about the command please refer to [SISMEMBER].

[SISMEMBER]: (https://redis.io/docs/latest/commands/sismember/)

func (ClusterClient) SMIsMember

func (c ClusterClient) SMIsMember(ctx context.Context, key string, members ...interface{}) *BoolSliceCmd

Returns whether each member is a member of the set stored at key. For each member, returns true if the element is a member of the set, false if it is not a member or if key does not exist.

For more information about the command please refer to [SMISMEMBER].

[SMISMEMBER]: (https://redis.io/docs/latest/commands/smismember/)

func (ClusterClient) SMembers

func (c ClusterClient) SMembers(ctx context.Context, key string) *StringSliceCmd

Returns all the members of the set value stored at key. Returns an empty slice if key does not exist.

For more information about the command please refer to [SMEMBERS].

[SMEMBERS]: (https://redis.io/docs/latest/commands/smembers/)

func (ClusterClient) SMembersMap

func (c ClusterClient) SMembersMap(ctx context.Context, key string) *StringStructMapCmd

Returns all the members of the set value stored at key as a map. Returns an empty map if key does not exist.

For more information about the command please refer to [SMEMBERS].

[SMEMBERS]: (https://redis.io/docs/latest/commands/smembers/)

func (ClusterClient) SMove

func (c ClusterClient) SMove(ctx context.Context, source, destination string, member interface{}) *BoolCmd

Moves member from the set at source to the set at destination. This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients.

For more information about the command please refer to [SMOVE].

[SMOVE]: (https://redis.io/docs/latest/commands/smove/)

func (ClusterClient) SPop

func (c ClusterClient) SPop(ctx context.Context, key string) *StringCmd

Removes and returns one or more random members from the set value stored at key. This version returns a single random member.

For more information about the command please refer to [SPOP].

[SPOP]: (https://redis.io/docs/latest/commands/spop/)

func (ClusterClient) SPopN

func (c ClusterClient) SPopN(ctx context.Context, key string, count int64) *StringSliceCmd

Removes and returns one or more random members from the set value stored at key. This version returns up to count random members.

For more information about the command please refer to [SPOP].

[SPOP]: (https://redis.io/docs/latest/commands/spop/)

func (ClusterClient) SPublish

func (c ClusterClient) SPublish(ctx context.Context, channel string, message interface{}) *IntCmd

func (ClusterClient) SRandMember

func (c ClusterClient) SRandMember(ctx context.Context, key string) *StringCmd

Returns a random member from the set value stored at key. This version returns a single random member without removing it.

For more information about the command please refer to [SRANDMEMBER].

[SRANDMEMBER]: (https://redis.io/docs/latest/commands/srandmember/)

func (ClusterClient) SRandMemberN

func (c ClusterClient) SRandMemberN(ctx context.Context, key string, count int64) *StringSliceCmd

Returns an array of random members from the set value stored at key. This version returns up to count random members without removing them. When called with a positive count, returns distinct elements. When called with a negative count, allows for repeated elements.

For more information about the command please refer to [SRANDMEMBER].

[SRANDMEMBER]: (https://redis.io/docs/latest/commands/srandmember/)

func (ClusterClient) SRem

func (c ClusterClient) SRem(ctx context.Context, key string, members ...interface{}) *IntCmd

Removes the specified members from the set stored at key. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.

For more information about the command please refer to [SREM].

[SREM]: (https://redis.io/docs/latest/commands/srem/)

func (ClusterClient) SScan

func (c ClusterClient) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd

Incrementally iterates the set elements stored at key. This is a cursor-based iterator that allows scanning large sets efficiently.

Parameters:

  • cursor: The cursor value for the iteration (use 0 to start a new scan)
  • match: Optional pattern to match elements (empty string means no pattern)
  • count: Optional hint about how many elements to return per iteration

For more information about the command please refer to [SSCAN].

[SSCAN]: (https://redis.io/docs/latest/commands/sscan/)

func (*ClusterClient) SSubscribe

func (c *ClusterClient) SSubscribe(ctx context.Context, channels ...string) *PubSub

SSubscribe Subscribes the client to the specified shard channels.

func (ClusterClient) SUnion

func (c ClusterClient) SUnion(ctx context.Context, keys ...string) *StringSliceCmd

Returns the members of the set resulting from the union of all the given sets. Keys that do not exist are considered to be empty sets.

For more information about the command please refer to [SUNION].

[SUNION]: (https://redis.io/docs/latest/commands/sunion/)

func (ClusterClient) SUnionCard added in v9.22.0

func (c ClusterClient) SUnionCard(ctx context.Context, opts *SUnionCardOptions, keys ...string) *IntCmd

Returns the cardinality of the union of all the given sets. Missing keys are treated as empty sets.

For more information about the command please refer to [SUNIONCARD].

[SUNIONCARD]: (https://redis.io/docs/latest/commands/sunioncard/)

func (ClusterClient) SUnionStore

func (c ClusterClient) SUnionStore(ctx context.Context, destination string, keys ...string) *IntCmd

Stores the members of the set resulting from the union of all the given sets into destination. If destination already exists, it is overwritten.

For more information about the command please refer to [SUNIONSTORE].

[SUNIONSTORE]: (https://redis.io/docs/latest/commands/sunionstore/)

func (ClusterClient) Save

func (c ClusterClient) Save(ctx context.Context) *StatusCmd

func (ClusterClient) Scan

func (c ClusterClient) Scan(ctx context.Context, cursor uint64, match string, count int64) *ScanCmd

func (ClusterClient) ScanType

func (c ClusterClient) ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) *ScanCmd

func (*ClusterClient) ScriptExists

func (c *ClusterClient) ScriptExists(ctx context.Context, hashes ...string) *BoolSliceCmd

func (*ClusterClient) ScriptFlush

func (c *ClusterClient) ScriptFlush(ctx context.Context) *StatusCmd

func (ClusterClient) ScriptKill

func (c ClusterClient) ScriptKill(ctx context.Context) *StatusCmd

func (*ClusterClient) ScriptLoad

func (c *ClusterClient) ScriptLoad(ctx context.Context, script string) *StringCmd

func (ClusterClient) Set

func (c ClusterClient) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

Set Redis `SET key value [expiration]` command. Use expiration for `SETEx`-like behavior.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (ClusterClient) SetArgs

func (c ClusterClient) SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.

func (ClusterClient) SetBit

func (c ClusterClient) SetBit(ctx context.Context, key string, offset int64, value int) *IntCmd

func (*ClusterClient) SetCommandInfoResolver added in v9.18.0

func (c *ClusterClient) SetCommandInfoResolver(cmdInfoResolver *commandInfoResolver)

func (ClusterClient) SetEx deprecated

func (c ClusterClient) SetEx(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd

SetEx sets the value and expiration of a key.

Deprecated: Use Set with expiration instead as of Redis 2.6.12.

func (ClusterClient) SetFromBuffer added in v9.21.0

func (c ClusterClient) SetFromBuffer(ctx context.Context, key string, buf []byte) *StatusCmd

SetFromBuffer executes SET writing the value directly from buf. For values larger than the connection's write buffer, bufio.Writer.Write flushes its internal buffer (containing the RESP header) and then writes buf straight to the socket — effectively zero-copy on the send path.

Expiration is not supported; use Expire separately if a TTL is required.

Note: SetFromBuffer is exposed for API symmetry with GetToBuffer and is functionally equivalent to Set(ctx, key, buf, 0) — both dispatch to the same []byte case in the RESP writer and produce identical bytes on the wire. The zero-copy property on the send path comes from bufio.Writer.Write bypassing its internal buffer for large payloads, which Set([]byte) gets automatically. Prefer SetFromBuffer in code that also uses GetToBuffer so the buffer-based pattern reads coherently; otherwise Set(ctx, key, buf, 0) is equally efficient.

func (ClusterClient) SetIFDEQ added in v9.17.0

func (c ClusterClient) SetIFDEQ(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StatusCmd

SetIFDEQ sets the value only if the current value's digest equals matchDigest.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns "OK" on success. Returns redis.Nil if the digest doesn't match (value was modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFNEQ is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFDEQGet added in v9.17.0

func (c ClusterClient) SetIFDEQGet(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StringCmd

SetIFDEQGet sets the value only if the current value's digest equals matchDigest, and returns the previous value.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns the previous value on success. Returns redis.Nil if the digest doesn't match (value was modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFNEQGet is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFDNE added in v9.17.0

func (c ClusterClient) SetIFDNE(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StatusCmd

SetIFDNE sets the value only if the current value's digest does NOT equal matchDigest.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns "OK" on success (digest didn't match, value was set). Returns redis.Nil if the digest matches (value was not modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFDNE is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFDNEGet added in v9.17.0

func (c ClusterClient) SetIFDNEGet(ctx context.Context, key string, value interface{}, matchDigest uint64, expiration time.Duration) *StringCmd

SetIFDNEGet sets the value only if the current value's digest does NOT equal matchDigest, and returns the previous value.

This is a compare-and-set operation using xxh3 digest for optimistic locking. The matchDigest parameter is a uint64 xxh3 hash value.

Returns the previous value on success (digest didn't match, value was set). Returns redis.Nil if the digest matches (value was not modified). Zero expiration means the key has no expiration time.

For examples of client-side digest generation and usage patterns, see: example/digest-optimistic-locking/

Redis 8.4+. See https://redis.io/commands/set/

NOTE SetIFDNEGet is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFEQ added in v9.17.0

func (c ClusterClient) SetIFEQ(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd

SetIFEQ Redis `SET key value [expiration] IFEQ match-value` command. Compare-and-set: only sets the value if the current value equals matchValue.

Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFEQ is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFEQGet added in v9.17.0

func (c ClusterClient) SetIFEQGet(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StringCmd

SetIFEQGet Redis `SET key value [expiration] IFEQ match-value GET` command. Compare-and-set with GET: only sets the value if the current value equals matchValue, and returns the previous value.

Returns the previous value on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFEQGet is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFNE added in v9.17.0

func (c ClusterClient) SetIFNE(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd

SetIFNE Redis `SET key value [expiration] IFNE match-value` command. Compare-and-set: only sets the value if the current value does not equal matchValue.

Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFNE is still experimental it's signature and behaviour may change

func (ClusterClient) SetIFNEGet added in v9.17.0

func (c ClusterClient) SetIFNEGet(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StringCmd

SetIFNEGet Redis `SET key value [expiration] IFNE match-value GET` command. Compare-and-set with GET: only sets the value if the current value does not equal matchValue, and returns the previous value.

Returns the previous value on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time.

NOTE SetIFNEGet is still experimental it's signature and behaviour may change

func (ClusterClient) SetNX

func (c ClusterClient) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd

SetNX sets the value of a key only if the key does not exist.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (ClusterClient) SetRange

func (c ClusterClient) SetRange(ctx context.Context, key string, offset int64, value string) *IntCmd

func (ClusterClient) SetXX

func (c ClusterClient) SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd

SetXX Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.

func (ClusterClient) Shutdown

func (c ClusterClient) Shutdown(ctx context.Context) *StatusCmd

func (ClusterClient) ShutdownNoSave

func (c ClusterClient) ShutdownNoSave(ctx context.Context) *StatusCmd

func (ClusterClient) ShutdownSave

func (c ClusterClient) ShutdownSave(ctx context.Context) *StatusCmd

func (*ClusterClient) SlaveForKey

func (c *ClusterClient) SlaveForKey(ctx context.Context, key string) (*Client, error)

SlaveForKey gets a client for a replica node to run any command on it. This is especially useful if we want to run a particular lua script which has only read only commands on the replica. This is because other redis commands generally have a flag that points that they are read only and automatically run on the replica nodes if ClusterOptions.ReadOnly flag is set to true.

func (ClusterClient) SlaveOf deprecated

func (c ClusterClient) SlaveOf(ctx context.Context, host, port string) *StatusCmd

SlaveOf sets a Redis server as a replica of another, or promotes it to being a master.

Deprecated: Use ReplicaOf instead as of Redis 5.0.0.

func (ClusterClient) SlowLogGet

func (c ClusterClient) SlowLogGet(ctx context.Context, num int64) *SlowLogCmd

func (ClusterClient) SlowLogLen added in v9.17.0

func (c ClusterClient) SlowLogLen(ctx context.Context) *IntCmd

func (ClusterClient) SlowLogReset added in v9.17.0

func (c ClusterClient) SlowLogReset(ctx context.Context) *StatusCmd

func (ClusterClient) Sort

func (c ClusterClient) Sort(ctx context.Context, key string, sort *Sort) *StringSliceCmd

func (ClusterClient) SortInterfaces

func (c ClusterClient) SortInterfaces(ctx context.Context, key string, sort *Sort) *SliceCmd

func (ClusterClient) SortRO

func (c ClusterClient) SortRO(ctx context.Context, key string, sort *Sort) *StringSliceCmd

func (ClusterClient) SortStore

func (c ClusterClient) SortStore(ctx context.Context, key, store string, sort *Sort) *IntCmd

func (ClusterClient) StrLen

func (c ClusterClient) StrLen(ctx context.Context, key string) *IntCmd

func (*ClusterClient) Subscribe

func (c *ClusterClient) Subscribe(ctx context.Context, channels ...string) *PubSub

Subscribe subscribes the client to the specified channels. Channels can be omitted to create empty subscription.

func (ClusterClient) Sync

func (c ClusterClient) Sync(_ context.Context)

func (ClusterClient) TDigestAdd added in v9.1.0

func (c ClusterClient) TDigestAdd(ctx context.Context, key string, elements ...float64) *StatusCmd

TDigestAdd adds one or more elements to a t-Digest data structure. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.add/

func (ClusterClient) TDigestByRank added in v9.1.0

func (c ClusterClient) TDigestByRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd

TDigestByRank returns an array of values from a t-Digest data structure based on their rank. The rank of an element is its position in the sorted list of all elements in the t-Digest. Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.byrank/

func (ClusterClient) TDigestByRevRank added in v9.1.0

func (c ClusterClient) TDigestByRevRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd

TDigestByRevRank returns an array of values from a t-Digest data structure based on their reverse rank. The reverse rank of an element is its position in the sorted list of all elements in the t-Digest when sorted in descending order. Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.byrevrank/

func (ClusterClient) TDigestCDF added in v9.1.0

func (c ClusterClient) TDigestCDF(ctx context.Context, key string, elements ...float64) *FloatSliceCmd

TDigestCDF returns an array of cumulative distribution function (CDF) values for one or more elements in a t-Digest data structure. The CDF value for an element is the fraction of all elements in the t-Digest that are less than or equal to it. Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.cdf/

func (ClusterClient) TDigestCreate added in v9.1.0

func (c ClusterClient) TDigestCreate(ctx context.Context, key string) *StatusCmd

TDigestCreate creates an empty t-Digest data structure with default parameters. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.create/

func (ClusterClient) TDigestCreateWithCompression added in v9.1.0

func (c ClusterClient) TDigestCreateWithCompression(ctx context.Context, key string, compression int64) *StatusCmd

TDigestCreateWithCompression creates an empty t-Digest data structure with a specified compression parameter. The compression parameter controls the accuracy and memory usage of the t-Digest. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.create/

func (ClusterClient) TDigestInfo added in v9.1.0

func (c ClusterClient) TDigestInfo(ctx context.Context, key string) *TDigestInfoCmd

TDigestInfo returns information about a t-Digest data structure. For more information - https://redis.io/commands/tdigest.info/

func (ClusterClient) TDigestMax added in v9.1.0

func (c ClusterClient) TDigestMax(ctx context.Context, key string) *FloatCmd

TDigestMax returns the maximum value from a t-Digest data structure. For more information - https://redis.io/commands/tdigest.max/

func (ClusterClient) TDigestMerge added in v9.1.0

func (c ClusterClient) TDigestMerge(ctx context.Context, destKey string, options *TDigestMergeOptions, sourceKeys ...string) *StatusCmd

TDigestMerge merges multiple t-Digest data structures into a single t-Digest. This function also allows for specifying additional options such as compression and override behavior. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.merge/

func (ClusterClient) TDigestMin added in v9.1.0

func (c ClusterClient) TDigestMin(ctx context.Context, key string) *FloatCmd

TDigestMin returns the minimum value from a t-Digest data structure. For more information - https://redis.io/commands/tdigest.min/

func (ClusterClient) TDigestQuantile added in v9.1.0

func (c ClusterClient) TDigestQuantile(ctx context.Context, key string, elements ...float64) *FloatSliceCmd

TDigestQuantile returns an array of quantile values for one or more elements in a t-Digest data structure. The quantile value for an element is the fraction of all elements in the t-Digest that are less than or equal to it. Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.quantile/

func (ClusterClient) TDigestRank added in v9.1.0

func (c ClusterClient) TDigestRank(ctx context.Context, key string, values ...float64) *IntSliceCmd

TDigestRank returns an array of rank values for one or more elements in a t-Digest data structure. The rank of an element is its position in the sorted list of all elements in the t-Digest. Returns an array of integers representing the rank values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.rank/

func (ClusterClient) TDigestReset added in v9.1.0

func (c ClusterClient) TDigestReset(ctx context.Context, key string) *StatusCmd

TDigestReset resets a t-Digest data structure to its initial state. Returns OK on success or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.reset/

func (ClusterClient) TDigestRevRank added in v9.1.0

func (c ClusterClient) TDigestRevRank(ctx context.Context, key string, values ...float64) *IntSliceCmd

TDigestRevRank returns an array of reverse rank values for one or more elements in a t-Digest data structure. The reverse rank of an element is its position in the sorted list of all elements in the t-Digest when sorted in descending order. Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.revrank/

func (ClusterClient) TDigestTrimmedMean added in v9.1.0

func (c ClusterClient) TDigestTrimmedMean(ctx context.Context, key string, lowCutQuantile, highCutQuantile float64) *FloatCmd

TDigestTrimmedMean returns the trimmed mean value from a t-Digest data structure. The trimmed mean is calculated by removing a specified fraction of the highest and lowest values from the t-Digest and then calculating the mean of the remaining values. Returns a float representing the trimmed mean value or an error if the operation could not be completed. For more information - https://redis.io/commands/tdigest.trimmed_mean/

func (ClusterClient) TSAdd added in v9.2.0

func (c ClusterClient) TSAdd(ctx context.Context, key string, timestamp interface{}, value float64) *IntCmd

TSAdd - Adds one or more observations to a t-digest sketch. For more information - https://redis.io/commands/ts.add/

func (ClusterClient) TSAddWithArgs added in v9.2.0

func (c ClusterClient) TSAddWithArgs(ctx context.Context, key string, timestamp interface{}, value float64, options *TSOptions) *IntCmd

TSAddWithArgs - Adds one or more observations to a t-digest sketch. This function also allows for specifying additional options such as: Retention, ChunkSize, Encoding, DuplicatePolicy and Labels. For more information - https://redis.io/commands/ts.add/

func (ClusterClient) TSAlter added in v9.2.0

func (c ClusterClient) TSAlter(ctx context.Context, key string, options *TSAlterOptions) *StatusCmd

TSAlter - Alters an existing time-series key with additional options. This function allows for specifying additional options such as: Retention, ChunkSize and DuplicatePolicy. For more information - https://redis.io/commands/ts.alter/

func (ClusterClient) TSCreate added in v9.2.0

func (c ClusterClient) TSCreate(ctx context.Context, key string) *StatusCmd

TSCreate - Creates a new time-series key. For more information - https://redis.io/commands/ts.create/

func (ClusterClient) TSCreateRule added in v9.2.0

func (c ClusterClient) TSCreateRule(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd

TSCreateRule - Creates a compaction rule from sourceKey to destKey. For more information - https://redis.io/commands/ts.createrule/

func (ClusterClient) TSCreateRuleWithArgs added in v9.2.0

func (c ClusterClient) TSCreateRuleWithArgs(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd

TSCreateRuleWithArgs - Creates a compaction rule from sourceKey to destKey with additional option. This function allows for specifying additional option such as: alignTimestamp. For more information - https://redis.io/commands/ts.createrule/

func (ClusterClient) TSCreateWithArgs added in v9.2.0

func (c ClusterClient) TSCreateWithArgs(ctx context.Context, key string, options *TSOptions) *StatusCmd

TSCreateWithArgs - Creates a new time-series key with additional options. This function allows for specifying additional options such as: Retention, ChunkSize, Encoding, DuplicatePolicy and Labels. For more information - https://redis.io/commands/ts.create/

func (ClusterClient) TSDecrBy added in v9.2.0

func (c ClusterClient) TSDecrBy(ctx context.Context, Key string, timestamp float64) *IntCmd

TSDecrBy - Decrements the value of a time-series key by the specified timestamp. For more information - https://redis.io/commands/ts.decrby/

func (ClusterClient) TSDecrByWithArgs added in v9.2.0

func (c ClusterClient) TSDecrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd

TSDecrByWithArgs - Decrements the value of a time-series key by the specified timestamp with additional options. This function allows for specifying additional options such as: Timestamp, Retention, ChunkSize, Uncompressed and Labels. For more information - https://redis.io/commands/ts.decrby/

func (ClusterClient) TSDel added in v9.2.0

func (c ClusterClient) TSDel(ctx context.Context, Key string, fromTimestamp int, toTimestamp int) *IntCmd

TSDel - Deletes a range of samples from a time-series key. For more information - https://redis.io/commands/ts.del/

func (ClusterClient) TSDeleteRule added in v9.2.0

func (c ClusterClient) TSDeleteRule(ctx context.Context, sourceKey string, destKey string) *StatusCmd

TSDeleteRule - Deletes a compaction rule from sourceKey to destKey. For more information - https://redis.io/commands/ts.deleterule/

func (ClusterClient) TSGet added in v9.2.0

func (c ClusterClient) TSGet(ctx context.Context, key string) *TSTimestampValueCmd

TSGet - Gets the last sample of a time-series key. For more information - https://redis.io/commands/ts.get/

func (ClusterClient) TSGetWithArgs added in v9.2.0

func (c ClusterClient) TSGetWithArgs(ctx context.Context, key string, options *TSGetOptions) *TSTimestampValueCmd

TSGetWithArgs - Gets the last sample of a time-series key with additional option. This function allows for specifying additional option such as: Latest. For more information - https://redis.io/commands/ts.get/

func (ClusterClient) TSIncrBy added in v9.2.0

func (c ClusterClient) TSIncrBy(ctx context.Context, Key string, timestamp float64) *IntCmd

TSIncrBy - Increments the value of a time-series key by the specified timestamp. For more information - https://redis.io/commands/ts.incrby/

func (ClusterClient) TSIncrByWithArgs added in v9.2.0

func (c ClusterClient) TSIncrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd

TSIncrByWithArgs - Increments the value of a time-series key by the specified timestamp with additional options. This function allows for specifying additional options such as: Timestamp, Retention, ChunkSize, Uncompressed and Labels. For more information - https://redis.io/commands/ts.incrby/

func (ClusterClient) TSInfo added in v9.2.0

func (c ClusterClient) TSInfo(ctx context.Context, key string) *MapStringInterfaceCmd

TSInfo - Returns information about a time-series key. For more information - https://redis.io/commands/ts.info/

func (ClusterClient) TSInfoWithArgs added in v9.2.0

func (c ClusterClient) TSInfoWithArgs(ctx context.Context, key string, options *TSInfoOptions) *MapStringInterfaceCmd

TSInfoWithArgs - Returns information about a time-series key with additional option. This function allows for specifying additional option such as: Debug. For more information - https://redis.io/commands/ts.info/

func (ClusterClient) TSMAdd added in v9.2.0

func (c ClusterClient) TSMAdd(ctx context.Context, ktvSlices [][]interface{}) *IntSliceCmd

TSMAdd - Adds multiple samples to multiple time-series keys. It accepts a slice of 'ktv' slices, each containing exactly three elements: key, timestamp, and value. This struct must be provided for this command to work. For more information - https://redis.io/commands/ts.madd/

func (ClusterClient) TSMGet added in v9.2.0

func (c ClusterClient) TSMGet(ctx context.Context, filters []string) *MapStringSliceInterfaceCmd

TSMGet - Returns the last sample of multiple time-series keys. For more information - https://redis.io/commands/ts.mget/

func (ClusterClient) TSMGetWithArgs added in v9.2.0

func (c ClusterClient) TSMGetWithArgs(ctx context.Context, filters []string, options *TSMGetOptions) *MapStringSliceInterfaceCmd

TSMGetWithArgs - Returns the last sample of multiple time-series keys with additional options. This function allows for specifying additional options such as: Latest, WithLabels and SelectedLabels. For more information - https://redis.io/commands/ts.mget/

func (ClusterClient) TSMRange added in v9.2.0

func (c ClusterClient) TSMRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd

TSMRange - Returns a range of samples from multiple time-series keys. For more information - https://redis.io/commands/ts.mrange/

func (ClusterClient) TSMRangeWithArgs added in v9.2.0

func (c ClusterClient) TSMRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd

TSMRangeWithArgs - Returns a range of samples from multiple time-series keys. Options are set via TSMRangeOptions. For more information - https://redis.io/commands/ts.mrange/

func (ClusterClient) TSMRevRange added in v9.2.0

func (c ClusterClient) TSMRevRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd

TSMRevRange - Returns a range of samples from multiple time-series keys in reverse order. For more information - https://redis.io/commands/ts.mrevrange/

func (ClusterClient) TSMRevRangeWithArgs added in v9.2.0

func (c ClusterClient) TSMRevRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd

TSMRevRangeWithArgs - Returns a range of samples from multiple time-series keys in reverse order. Options are set via TSMRevRangeOptions. For more information - https://redis.io/commands/ts.mrevrange/

func (ClusterClient) TSNRange added in v9.22.0

func (c ClusterClient) TSNRange(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}) *TSNRangePivotRowSliceCmd

TSNRange - Queries multiple time-series keys and returns a pivot response in forward (ascending) order. For more information - https://redis.io/commands/ts.nrange/

func (ClusterClient) TSNRangeWithArgs added in v9.22.0

func (c ClusterClient) TSNRangeWithArgs(ctx context.Context, keys []string, fromTimestamp interface{}, toTimestamp interface{}, options *TSNRangeOptions) *TSNRangePivotRowSliceCmd

TSNRangeWithArgs - Queries multiple time-series keys and returns a pivot response in forward (ascending) order with additional options. This function allows for specifying additional options such as: Latest, FilterByTS, FilterByValue, Count, Align, Aggregators, BucketDuration, BucketTimestamp and Empty. Aggregators must contain exactly one spec per key; each spec lists one or more aggregators for its key and is emitted as a single comma-joined wire token. For more information - https://redis.io/commands/ts.nrange/

func (ClusterClient) TSNRevRange added in v9.22.0

func (c ClusterClient) TSNRevRange(ctx context.Context, keys []string, fromTimestamp interface{}, toTim