redis

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 3 Imported by: 0

README

redis

简介

redis 包提供了 Go 语言下的高性能 Redis 客户端接口与扩展,支持原生命令、管道、事务、Lua 脚本、发布订阅、基础 KV 操作等,兼容 go-redis v9,适合缓存、分布式锁、消息队列等多种场景。

主要特性
  • 统一 Redis 客户端接口,支持 Do/Pipelined/TxPipelined/Subscribe/PSubscribe
  • 支持扩展接口(Get/Set/Del/Expire 等常用命令)
  • 支持 Lua 脚本(Eval/EvalSha/ScriptLoad/ScriptExists 等)
  • 支持发布订阅(PubSub)
  • 支持 Option 配置(地址、密码等)
  • 完善的错误处理与类型封装
  • 完整单元测试覆盖
设计理念

redis 包遵循"简洁、兼容、易扩展"的设计理念,接口与 go-redis v9 保持一致,支持 Option 配置,便于集成与二次封装。扩展接口覆盖常用场景,底层类型与命令高度兼容官方客户端。

安装

前置条件
  • Go 版本要求:Go 1.18+
  • 依赖要求:
    • github.com/redis/go-redis/v9
    • github.com/stretchr/testify(仅测试)
安装命令
go get -u github.com/fsyyft-go/kit/database/redis

快速开始

基础用法
package main

import (
    "context"
    "fmt"
    "github.com/fsyyft-go/kit/database/redis"
    "time"
)

func main() {
    // 创建 Redis 客户端,默认 127.0.0.1:6379
    rdb := redis.NewRedis()
    ext := redis.NewRedisExtension(rdb)
    ctx := context.Background()
    // 基础 KV 操作
    ext.Set(ctx, "foo", "bar", time.Second*10)
    val, err := ext.Get(ctx, "foo").Result()
    if err != nil {
        panic(err)
    }
    fmt.Println("foo:", val)
}
管道与事务
// 管道批量操作
_, err := rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {
    pipe.Do(ctx, "SET", "k1", "v1")
    pipe.Do(ctx, "SET", "k2", "v2")
    return nil
})

// 事务管道
_, err := rdb.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
    pipe.Do(ctx, "INCR", "counter")
    return nil
})
Lua 脚本
script := `return ARGV[1]`
sha, _ := rdb.ScriptLoad(ctx, script).Result()
res, _ := rdb.EvalSha(ctx, sha, []string{}, 123).Result()
fmt.Println(res)
发布订阅
pubsub := rdb.Subscribe(ctx, "my-channel")
go func() {
    msg, _ := pubsub.ReceiveMessage(ctx)
    fmt.Println("收到消息:", msg.Payload)
}()
rdb.Do(ctx, "PUBLISH", "my-channel", "hello")

详细指南

核心概念
  • Redis 接口:统一封装 go-redis v9,支持所有原生命令
  • 扩展接口:常用 KV 操作、过期、删除等
  • 管道/事务:批量高效操作,事务保证原子性
  • Lua 脚本:支持 Eval/EvalSha/ScriptLoad/ScriptExists
  • 发布订阅:支持多频道订阅与消息收发
  • Option 配置:灵活设置地址、密码等参数
常见用例
  • 缓存读写
  • 分布式锁
  • 计数器/排行榜
  • 消息队列/事件通知
  • 脚本原子操作
最佳实践
  • 生产环境建议配置密码与连接池参数
  • 管道/事务适合批量高并发场景
  • 脚本操作建议预加载并用 SHA 调用
  • 发布订阅需注意消息可靠性
  • 始终检查命令返回的 error

API 文档

主要类型
// Redis 客户端接口
 type Redis interface {
    Do(ctx context.Context, args ...interface{}) *Cmd
    Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
    TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
    Subscribe(ctx context.Context, channels ...string) *PubSub
    PSubscribe(ctx context.Context, channels ...string) *PubSub
}

// Redis 扩展接口
 type RedisExtension interface {
    Redis
    Get(ctx context.Context, key string) *Cmd
    Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *Cmd
    Del(ctx context.Context, key string) *Cmd
    Expire(ctx context.Context, key string, expiration time.Duration) *Cmd
}

// Option 配置项类型
 type Option func(*redisClient)

// NewRedis 创建客户端
func NewRedis(opts ...Option) Redis

// NewRedisExtension 创建扩展
func NewRedisExtension(redis Redis) RedisExtension
关键函数
  • NewRedis:创建 Redis 客户端,支持 Option 配置
  • Do:执行任意命令
  • Pipelined/TxPipelined:管道/事务批量操作
  • Subscribe/PSubscribe:发布订阅
  • Eval/EvalSha/ScriptLoad/ScriptExists:Lua 脚本
  • Get/Set/Del/Expire:常用 KV 操作
配置选项
  • WithAddr(addr string):设置 Redis 地址
  • WithPassword(password string):设置密码

错误处理

  • 所有命令均返回 *Cmd,需调用 Result() 获取结果与错误
  • 不存在 key 时返回 redis.ErrNil
  • 连接失败、参数错误等均有详细错误
  • Option 多次叠加后者生效

性能指标

  • 单连接 QPS 万级,管道/批量操作可进一步提升
  • 脚本/事务操作性能取决于 Redis 服务端

测试覆盖率

  • 单元测试覆盖所有接口、边界、异常场景
  • 使用 testify,覆盖率 100%

调试指南

  • 检查 Redis 服务是否可用(默认 127.0.0.1:6379)
  • Option 配置可多次叠加,后者生效
  • 脚本调试建议先用 Eval 验证

相关文档

贡献指南

欢迎提交 Issue、PR 或建议,详见 贡献指南

许可证

本项目采用 MIT License 许可证。详见 LICENSE

Documentation

Overview

Package redis 提供了 Redis 客户端的基础类型和命令定义。

Package redis 提供了 Redis 操作的扩展功能实现。

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNil 当 Get、GetStruct 等方法期望返回非 nil 值但实际返回 nil 时返回此错误。
	ErrNil = redis.Nil

	// ErrClosed 当对已关闭的客户端执行操作时返回此错误。
	ErrClosed = redis.ErrClosed

	// TxFailedErr 表示 Redis 事务执行失败的错误。
	TxFailedErr = redis.TxFailedErr //nolint:errname
)

Functions

This section is empty.

Types

type ACLLogCmd

type ACLLogCmd = redis.ACLLogCmd

ACLLogCmd 表示返回 ACL 日志的 Redis 命令。

type ACLLogEntry

type ACLLogEntry = redis.ACLLogEntry

ACLLogEntry 表示 ACL 日志条目类型。

type BitCount

type BitCount = redis.BitCount

BitCount 表示位计数参数类型。

type BoolCmd

type BoolCmd = redis.BoolCmd

BoolCmd 表示返回布尔类型的 Redis 命令。

type BoolSliceCmd

type BoolSliceCmd = redis.BoolSliceCmd

BoolSliceCmd 表示返回布尔切片类型的 Redis 命令。

type ClientFlags

type ClientFlags = redis.ClientFlags

ClientFlags 表示客户端标志类型。

type ClientInfo

type ClientInfo = redis.ClientInfo

ClientInfo 表示客户端信息类型。

type ClientInfoCmd

type ClientInfoCmd = redis.ClientInfoCmd

ClientInfoCmd 表示返回客户端信息的 Redis 命令。

type ClusterLink = redis.ClusterLink

ClusterLink 表示集群链接类型。

type ClusterLinksCmd

type ClusterLinksCmd = redis.ClusterLinksCmd

ClusterLinksCmd 表示返回集群链接信息的 Redis 命令。

type ClusterNode

type ClusterNode = redis.ClusterNode

ClusterNode 表示集群节点信息类型。

type ClusterShard

type ClusterShard = redis.ClusterShard

ClusterShard 表示集群分片类型。

type ClusterShardsCmd

type ClusterShardsCmd = redis.ClusterShardsCmd

ClusterShardsCmd 表示返回集群分片信息的 Redis 命令。

type ClusterSlot

type ClusterSlot = redis.ClusterSlot

ClusterSlot 表示集群槽位信息类型。

type ClusterSlotsCmd

type ClusterSlotsCmd = redis.ClusterSlotsCmd

ClusterSlotsCmd 表示返回集群槽位信息的 Redis 命令。

type Cmd

type Cmd = redis.Cmd

Cmd 表示通用的 Redis 命令。

type Cmder

type Cmder = redis.Cmder

Cmder 表示 Redis 命令的基础接口。

type CommandInfo

type CommandInfo = redis.CommandInfo

CommandInfo 表示命令信息类型。

type CommandsInfoCmd

type CommandsInfoCmd = redis.CommandsInfoCmd

CommandsInfoCmd 表示返回命令信息的 Redis 命令。

type DurationCmd

type DurationCmd = redis.DurationCmd

DurationCmd 表示返回时间间隔类型的 Redis 命令。

type Engine

type Engine = redis.Engine

Engine 表示脚本引擎类型。

type FilterBy

type FilterBy = redis.FilterBy

FilterBy 表示过滤条件类型。

type FloatCmd

type FloatCmd = redis.FloatCmd

FloatCmd 表示返回浮点数类型的 Redis 命令。

type FloatSliceCmd

type FloatSliceCmd = redis.FloatSliceCmd

FloatSliceCmd 表示返回浮点数切片类型的 Redis 命令。

type Function

type Function = redis.Function

Function 表示 Redis 函数类型。

type FunctionListCmd

type FunctionListCmd = redis.FunctionListCmd

FunctionListCmd 表示返回函数列表的 Redis 命令。

type FunctionListQuery

type FunctionListQuery = redis.FunctionListQuery

FunctionListQuery 表示函数列表查询参数类型。

type FunctionStats

type FunctionStats = redis.FunctionStats

FunctionStats 表示函数统计信息类型。

type FunctionStatsCmd

type FunctionStatsCmd = redis.FunctionStatsCmd

FunctionStatsCmd 表示返回函数统计信息的 Redis 命令。

type GeoLocation

type GeoLocation = redis.GeoLocation

GeoLocation 表示地理位置信息类型。

type GeoLocationCmd

type GeoLocationCmd = redis.GeoLocationCmd

GeoLocationCmd 表示返回地理位置信息的 Redis 命令。

type GeoPos

type GeoPos = redis.GeoPos

GeoPos 表示地理位置坐标类型。

type GeoPosCmd

type GeoPosCmd = redis.GeoPosCmd

GeoPosCmd 表示返回地理位置坐标的 Redis 命令。

type GeoRadiusQuery

type GeoRadiusQuery = redis.GeoRadiusQuery

GeoRadiusQuery 表示地理位置半径查询类型。

type GeoSearchLocationCmd

type GeoSearchLocationCmd = redis.GeoSearchLocationCmd

GeoSearchLocationCmd 表示返回地理位置搜索结果的 Redis 命令。

type GeoSearchLocationQuery

type GeoSearchLocationQuery = redis.GeoSearchLocationQuery

GeoSearchLocationQuery 表示地理位置搜索位置查询类型。

type GeoSearchQuery

type GeoSearchQuery = redis.GeoSearchQuery

GeoSearchQuery 表示地理位置搜索查询类型。

type GeoSearchStoreQuery

type GeoSearchStoreQuery = redis.GeoSearchStoreQuery

GeoSearchStoreQuery 表示地理位置搜索存储查询类型。

type IntCmd

type IntCmd = redis.IntCmd

IntCmd 表示返回整数类型的 Redis 命令。

type IntSliceCmd

type IntSliceCmd = redis.IntSliceCmd

IntSliceCmd 表示返回整数切片类型的 Redis 命令。

type KeyFlags

type KeyFlags = redis.KeyFlags

KeyFlags 表示键标志类型。

type KeyFlagsCmd

type KeyFlagsCmd = redis.KeyFlagsCmd

KeyFlagsCmd 表示返回键标志的 Redis 命令。

type KeyValue

type KeyValue = redis.KeyValue

KeyValue 表示键值对类型。

type KeyValueSliceCmd

type KeyValueSliceCmd = redis.KeyValueSliceCmd

KeyValueSliceCmd 表示返回键值对切片类型的 Redis 命令。

type KeyValuesCmd

type KeyValuesCmd = redis.KeyValuesCmd

KeyValuesCmd 表示返回键值对类型的 Redis 命令。

type LCSCmd

type LCSCmd = redis.LCSCmd

LCSCmd 表示返回最长公共子序列的 Redis 命令。

type LCSMatch

type LCSMatch = redis.LCSMatch

LCSMatch 表示最长公共子序列匹配类型。

type LCSMatchedPosition

type LCSMatchedPosition = redis.LCSMatchedPosition

LCSMatchedPosition 表示最长公共子序列匹配位置类型。

type LCSPosition

type LCSPosition = redis.LCSPosition

LCSPosition 表示最长公共子序列位置类型。

type LCSQuery

type LCSQuery = redis.LCSQuery

LCSQuery 表示最长公共子序列查询类型。

type LPosArgs

type LPosArgs = redis.LPosArgs

LPosArgs 表示列表位置查询参数类型。

type Library

type Library = redis.Library

Library 表示 Redis 库类型。

type MapStringIntCmd

type MapStringIntCmd = redis.MapStringIntCmd

MapStringIntCmd 表示返回字符串到整数映射类型的 Redis 命令。

type MapStringInterfaceCmd

type MapStringInterfaceCmd = redis.MapStringInterfaceCmd

MapStringInterfaceCmd 表示返回字符串到接口映射类型的 Redis 命令。

type MapStringStringCmd

type MapStringStringCmd = redis.MapStringStringSliceCmd

MapStringStringCmd 表示返回字符串到字符串映射类型的 Redis 命令。

type MapStringStringSliceCmd

type MapStringStringSliceCmd = redis.MapStringStringSliceCmd

MapStringStringSliceCmd 表示返回字符串到字符串切片映射类型的 Redis 命令。

type Message

type Message = redis.Message

Message 表示消息类型。

type ModuleLoadexConfig

type ModuleLoadexConfig = redis.ModuleLoadexConfig

ModuleLoadexConfig 表示模块加载配置类型。

type Node

type Node = redis.Node

Node 表示节点类型。

type Option

type Option func(*redisClient)

Option 定义了 Redis 客户端的配置选项类型。 用于在创建 Redis 客户端时进行自定义配置。

func WithAddr

func WithAddr(addr string) Option

WithAddr 设置 Redis 服务器的地址。

参数:

  • addr:Redis 服务器的地址,格式为 "host:port"

返回值:

  • Option:配置选项函数

func WithPassword

func WithPassword(password string) Option

WithPassword 设置连接 Redis 服务器的密码。

参数:

  • password:Redis 服务器的认证密码

返回值:

  • Option:配置选项函数

type Pipeliner

type Pipeliner = redis.Pipeliner

Pipeliner 表示 Redis 管道操作接口。

type Pong

type Pong = redis.Pong

Pong 表示 PING 命令响应类型。

type PubSub

type PubSub = redis.PubSub

PubSub 表示发布订阅客户端类型。

type RankScore

type RankScore = redis.RankScore

RankScore 表示排名分数类型。

type RankWithScoreCmd

type RankWithScoreCmd = redis.RankWithScoreCmd

RankWithScoreCmd 表示返回带分数的排名的 Redis 命令。

type Redis

type Redis interface {
	Scripter

	// Do 执行任意 Redis 命令。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - args:命令的参数列表
	//
	// 返回值:
	//   - *Cmd:通用的命令结果对象
	Do(ctx context.Context, args ...interface{}) *Cmd

	// Pipelined 在管道中执行多个命令。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - fn:定义要在管道中执行的命令的函数
	//
	// 返回值:
	//   - []Cmder:管道中所有命令的执行结果
	//   - error:执行过程中的错误信息
	Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)

	// TxPipelined 在事务管道中执行多个命令。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - fn:定义要在事务管道中执行的命令的函数
	//
	// 返回值:
	//   - []Cmder:事务中所有命令的执行结果
	//   - error:执行过程中的错误信息
	TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)

	// Subscribe 订阅指定的频道。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制订阅的生命周期
	//   - channels:要订阅的频道列表
	//
	// 返回值:
	//   - *PubSub:发布订阅客户端对象
	Subscribe(ctx context.Context, channels ...string) *PubSub

	// PSubscribe 使用模式匹配订阅频道。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制订阅的生命周期
	//   - channels:要订阅的频道模式列表
	//
	// 返回值:
	//   - *PubSub:发布订阅客户端对象
	PSubscribe(ctx context.Context, channels ...string) *PubSub

	// Close 关闭 Redis 客户端。
	//
	// 返回值:
	//   - error:关闭过程中发生的错误
	Close() error
}

Redis 接口定义了 Redis 客户端的基本操作。

func NewRedis

func NewRedis(opts ...Option) Redis

NewRedis 创建一个新的 Redis 客户端实例。

参数:

  • opts:可选的配置选项

返回值:

  • Redis:Redis 客户端接口实例

type RedisExtension

type RedisExtension interface {
	Redis

	// Get 获取指定键的值。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - key:要获取的键名
	//
	// 返回值:
	//   - *Cmd:命令执行结果
	Get(ctx context.Context, key string) *Cmd

	// Set 设置指定键的值。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - key:要设置的键名
	//   - value:要设置的值
	//   - expiration:键的过期时间
	//
	// 返回值:
	//   - *Cmd:命令执行结果
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *Cmd

	// Del 删除指定的键。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - key:要删除的键名
	//
	// 返回值:
	//   - *Cmd:命令执行结果
	Del(ctx context.Context, key string) *Cmd

	// Expire 设置指定键的过期时间。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//   - key:要设置过期时间的键名
	//   - expiration:过期时间
	//
	// 返回值:
	//   - *Cmd:命令执行结果
	Expire(ctx context.Context, key string, expiration time.Duration) *Cmd

	// ScriptFlush 清空脚本缓存。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//
	// 返回值:
	//   - *StatusCmd:命令执行状态
	ScriptFlush(ctx context.Context) *StatusCmd

	// ScriptKill 终止当前正在执行的脚本。
	//
	// 参数:
	//   - ctx:上下文对象,用于控制命令的执行
	//
	// 返回值:
	//   - *StatusCmd:命令执行状态
	ScriptKill(ctx context.Context) *StatusCmd
}

RedisExtension 定义了 Redis 扩展接口,继承自基础 Redis 接口,提供额外的功能扩展。

func NewRedisExtension

func NewRedisExtension(redis Redis) RedisExtension

NewRedisExtension 创建一个新的 Redis 扩展实例。

参数:

  • redis:基础的 Redis 接口实现

返回值:

  • RedisExtension:Redis 扩展接口实例

type RunningScript

type RunningScript = redis.RunningScript

RunningScript 表示运行中的脚本类型。

type ScanCmd

type ScanCmd = redis.ScanCmd

ScanCmd 表示扫描操作的 Redis 命令。

type Scripter

type Scripter = redis.Scripter

Scripter 表示 Redis 脚本操作接口。

type SetArgs

type SetArgs = redis.SetArgs

SetArgs 表示设置命令的参数类型。

type SliceCmd

type SliceCmd = redis.SliceCmd

SliceCmd 表示返回切片类型的 Redis 命令。

type SlotRange

type SlotRange = redis.SlotRange

SlotRange 表示槽位范围类型。

type SlowLog

type SlowLog = redis.SlowLog

SlowLog 表示慢查询日志类型。

type SlowLogCmd

type SlowLogCmd = redis.SlowLogCmd

SlowLogCmd 表示返回慢查询日志的 Redis 命令。

type Sort

type Sort = redis.Sort

Sort 表示排序参数类型。

type StatusCmd

type StatusCmd = redis.StatusCmd

StatusCmd 表示返回状态类型的 Redis 命令。

type StringCmd

type StringCmd = redis.StringCmd

StringCmd 表示返回字符串类型的 Redis 命令。

type StringSliceCmd

type StringSliceCmd = redis.StringSliceCmd

StringSliceCmd 表示返回字符串切片类型的 Redis 命令。

type StringStructMapCmd

type StringStructMapCmd = redis.StringStructMapCmd

StringStructMapCmd 表示返回字符串到结构体映射类型的 Redis 命令。

type Subscription

type Subscription = redis.Subscription

Subscription 表示订阅信息类型。

type TimeCmd

type TimeCmd = redis.TimeCmd

TimeCmd 表示返回时间类型的 Redis 命令。

type XAddArgs

type XAddArgs = redis.XAddArgs

XAddArgs 表示 Stream 添加消息的参数类型。

type XAutoClaimCmd

type XAutoClaimCmd = redis.XAutoClaimCmd

XAutoClaimCmd 表示自动认领消息的 Redis 命令。

type XAutoClaimJustIDCmd

type XAutoClaimJustIDCmd = redis.XAutoClaimJustIDCmd

XAutoClaimJustIDCmd 表示仅返回自动认领消息 ID 的 Redis 命令。

type XClaimArgs

type XClaimArgs = redis.XClaimArgs

XClaimArgs 表示消息认领参数类型。

type XInfoConsumer

type XInfoConsumer = redis.XInfoConsumer

XInfoConsumer 表示消费者信息类型。

type XInfoConsumersCmd

type XInfoConsumersCmd = redis.XInfoConsumersCmd

XInfoConsumersCmd 表示返回消费者信息的 Redis 命令。

type XInfoGroup

type XInfoGroup = redis.XInfoGroup

XInfoGroup 表示消费者组信息类型。

type XInfoGroupsCmd

type XInfoGroupsCmd = redis.XInfoGroupsCmd

XInfoGroupsCmd 表示返回消费者组信息的 Redis 命令。

type XInfoStream

type XInfoStream = redis.XInfoStream

XInfoStream 表示 Stream 信息类型。

type XInfoStreamCmd

type XInfoStreamCmd = redis.XInfoStreamCmd

XInfoStreamCmd 表示返回 Stream 信息的 Redis 命令。

type XInfoStreamConsumer

type XInfoStreamConsumer = redis.XInfoStreamConsumer

XInfoStreamConsumer 表示 Stream 消费者信息类型。

type XInfoStreamConsumerPending

type XInfoStreamConsumerPending = redis.XInfoStreamConsumerPending

XInfoStreamConsumerPending 表示 Stream 消费者待处理消息信息类型。

type XInfoStreamFull

type XInfoStreamFull = redis.XInfoStreamFull

XInfoStreamFull 表示完整 Stream 信息类型。

type XInfoStreamFullCmd

type XInfoStreamFullCmd = redis.XInfoStreamFullCmd

XInfoStreamFullCmd 表示返回完整 Stream 信息的 Redis 命令。

type XInfoStreamGroup

type XInfoStreamGroup = redis.XInfoStreamGroup

XInfoStreamGroup 表示 Stream 组信息类型。

type XInfoStreamGroupPending

type XInfoStreamGroupPending = redis.XInfoStreamGroupPending

XInfoStreamGroupPending 表示 Stream 组待处理消息信息类型。

type XMessage

type XMessage = redis.XMessage

XMessage 表示 Redis Stream 消息类型。

type XMessageSliceCmd

type XMessageSliceCmd = redis.XMessageSliceCmd

XMessageSliceCmd 表示返回 Stream 消息切片类型的 Redis 命令。

type XPending

type XPending = redis.XPending

XPending 表示待处理消息类型。

type XPendingCmd

type XPendingCmd = redis.XPendingCmd

XPendingCmd 表示返回待处理消息类型的 Redis 命令。

type XPendingExt

type XPendingExt = redis.XPendingExt

XPendingExt 表示扩展的待处理消息类型。

type XPendingExtArgs

type XPendingExtArgs = redis.XPendingExtArgs

XPendingExtArgs 表示扩展待处理消息查询参数类型。

type XPendingExtCmd

type XPendingExtCmd = redis.XPendingExtCmd

XPendingExtCmd 表示返回扩展待处理消息类型的 Redis 命令。

type XReadArgs

type XReadArgs = redis.XReadArgs

XReadArgs 表示 Stream 读取消息的参数类型。

type XReadGroupArgs

type XReadGroupArgs = redis.XReadGroupArgs

XReadGroupArgs 表示 Stream 消费者组读取消息的参数类型。

type XStream

type XStream = redis.XStream

XStream 表示 Redis Stream 类型。

type XStreamSliceCmd

type XStreamSliceCmd = redis.XStreamSliceCmd

XStreamSliceCmd 表示返回 Stream 切片类型的 Redis 命令。

type Z

type Z = redis.Z

Z 表示有序集合元素类型。

type ZAddArgs

type ZAddArgs = redis.ZAddArgs

ZAddArgs 表示有序集合添加元素的参数类型。

type ZRangeArgs

type ZRangeArgs = redis.ZRangeArgs

ZRangeArgs 表示有序集合范围查询参数类型。

type ZRangeBy

type ZRangeBy = redis.ZRangeBy

ZRangeBy 表示有序集合范围查询参数类型。

type ZSliceCmd

type ZSliceCmd = redis.ZSliceCmd

ZSliceCmd 表示返回有序集合切片类型的 Redis 命令。

type ZSliceWithKeyCmd

type ZSliceWithKeyCmd = redis.ZSliceWithKeyCmd

ZSliceWithKeyCmd 表示返回带键的有序集合切片类型的 Redis 命令。

type ZStore

type ZStore = redis.ZStore

ZStore 表示有序集合存储参数类型。

type ZWithKey

type ZWithKey = redis.ZWithKey

ZWithKey 表示带键的有序集合元素类型。

type ZWithKeyCmd

type ZWithKeyCmd = redis.ZWithKeyCmd

ZWithKeyCmd 表示返回带键的有序集合类型的 Redis 命令。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL