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 ¶
- func AcquireLease(ctx context.Context, client goredis.UniversalClient, key string, ...) (string, bool, error)
- func ConsumeIfExists(ctx context.Context, client goredis.UniversalClient, key string) (bool, error)
- func DeleteByPattern(ctx context.Context, client goredis.UniversalClient, pattern string, ...) (int, error)
- func JitterTTL(ttl time.Duration, ratio float64) time.Duration
- func NormalizeNamespace(ns string) string
- func ReleaseLease(ctx context.Context, client goredis.UniversalClient, key, token string) error
- func ScanKeys(ctx context.Context, client goredis.UniversalClient, pattern string, ...) ([]string, error)
- type DeleteBatch
- type DeleteByPatternOptions
- type KeyPattern
- type Keyspace
- type Namespace
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 ¶
ConsumeIfExists 原子地检查并删除单个键。
func DeleteByPattern ¶
func DeleteByPattern(ctx context.Context, client goredis.UniversalClient, pattern string, opts DeleteByPatternOptions) (int, error)
DeleteByPattern 按批次扫描并删除匹配模式的键。
func NormalizeNamespace ¶
NormalizeNamespace 去掉 Redis 命名空间两端的分隔符。
func ReleaseLease ¶
ReleaseLease 仅在租约 token 仍匹配时释放锁。
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 Namespace ¶ added in v0.5.3
type Namespace = rediskeyspace.Namespace
Namespace 是 Foundation 层命名空间值对象的兼容别名。
Click to show internal directories.
Click to hide internal directories.