rediscache

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheKey

func CacheKey(key string, params ...any) string

CacheKey 缓存 key 拼接

func NewRedis

func NewRedis(network string, addrs string, db int) (*redis.Client, func())

func NewRedisCluster

func NewRedisCluster(addrs []string) (*redis.ClusterClient, func())

func NewRedisParseUrl

func NewRedisParseUrl(url string) (*redis.Client, func())

func NewRedisRing

func NewRedisRing(addrs map[string]string, db int) (*redis.Ring, func())

Types

type RedisCache

type RedisCache[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](client *redis.Client) *RedisCache[T]

func (*RedisCache[T]) Delete

func (r *RedisCache[T]) Delete(ctx context.Context, keys ...string) error

func (*RedisCache[T]) Get

func (r *RedisCache[T]) Get(ctx context.Context, key string) (T, error)

func (*RedisCache[T]) Set

func (r *RedisCache[T]) Set(ctx context.Context, key string, value T, ttl time.Duration) error

Jump to

Keyboard shortcuts

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