rediskit

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package rediskit 提供 component-base Redis Foundation 的兼容门面。

新的 Foundation 子包位于:

  • pkg/redis/runtime
  • pkg/redis/keyspace
  • pkg/redis/ops
  • pkg/redis/store
  • pkg/redis/lease
  • pkg/redis/observability

当前根包刻意保留旧 helper 的稳定性,并将实现委托给新的 Foundation 子包。需要新能力的调用方应优先直接导入子包。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireLease

func AcquireLease(ctx context.Context, client goredis.UniversalClient, key string, ttl time.Duration) (string, bool, error)

AcquireLease 使用 SET NX EX 语义尝试获取租约锁。

func ConsumeIfExists

func ConsumeIfExists(ctx context.Context, client goredis.UniversalClient, key string) (bool, error)

ConsumeIfExists 原子地检查并删除单个键。

func DeleteByPattern

func DeleteByPattern(ctx context.Context, client goredis.UniversalClient, pattern string, opts DeleteByPatternOptions) (int, error)

DeleteByPattern 按批次扫描并删除匹配模式的键。

func JitterTTL

func JitterTTL(ttl time.Duration, ratio float64) time.Duration

JitterTTL 按比例为 TTL 增加对称抖动。

func NormalizeNamespace

func NormalizeNamespace(ns string) string

NormalizeNamespace 去掉 Redis 命名空间两端的分隔符。

func ReleaseLease

func ReleaseLease(ctx context.Context, client goredis.UniversalClient, key, token string) error

ReleaseLease 仅在租约 token 仍匹配时释放锁。

func ScanKeys

func ScanKeys(ctx context.Context, client goredis.UniversalClient, pattern string, count int64) ([]string, error)

ScanKeys 使用 SCAN 收集匹配模式的键。

Types

type DeleteBatch added in v0.5.3

type DeleteBatch = redisops.DeleteBatch

DeleteBatch 是分批删除观测结果的兼容别名。

type DeleteByPatternOptions

type DeleteByPatternOptions = redisops.DeleteByPatternOptions

DeleteByPatternOptions 是按模式删除配置的兼容别名。

func DefaultDeleteByPatternOptions

func DefaultDeleteByPatternOptions() DeleteByPatternOptions

DefaultDeleteByPatternOptions 返回标准按模式删除默认配置。

type KeyPattern added in v0.5.3

type KeyPattern = rediskeyspace.KeyPattern

KeyPattern 是带命名空间模式值对象的兼容别名。

type Keyspace

type Keyspace = rediskeyspace.Keyspace

Keyspace 是 Foundation 层 Keyspace 的兼容别名。

func NewKeyspace

func NewKeyspace(namespace string) Keyspace

NewKeyspace 创建带命名空间的 Keyspace 兼容入口。

type Namespace added in v0.5.3

type Namespace = rediskeyspace.Namespace

Namespace 是 Foundation 层命名空间值对象的兼容别名。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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