Documentation
¶
Index ¶
Constants ¶
View Source
const RedisNil = redis.Nil
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICache ¶
type ICache interface { Get(ctx context.Context, key string) *redis.StringCmd Set(ctx context.Context, key string, value any, ex time.Duration) *redis.StatusCmd MGet(ctx context.Context, keys ...string) *redis.SliceCmd MSet(ctx context.Context, values ...interface{}) *redis.StatusCmd Pipeline() redis.Pipeliner }
type JSON ¶
type JSON[T any] struct { Conn ICache Key string Expire time.Duration // 默认缓存时间 1 小时 Getter Getter[T] }
JSON 结构包含与 Redis 缓存的连接、操作的 key、 数据失效时间和构建缓存数据的 Builder 函数。
type MGetJson ¶
type PipelineGetGetter ¶
Click to show internal directories.
Click to hide internal directories.