cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRedis

func SetupRedis(configPath string) (err error)

SetupRedis 根据配置名称初始化 Redis configPath 对应 config.Add("redis", ...) 里的 "redis"

Types

type RedisClient

type RedisClient struct {
	Client *redis.Client
	// contains filtered or unexported fields
}

RedisClient 封装结构

func Instance

func Instance() *RedisClient

Instance 对外暴露的单例获取函数

func (*RedisClient) Del

func (rc *RedisClient) Del(ctx context.Context, keys ...string) bool

func (*RedisClient) GetObj

func (rc *RedisClient) GetObj(ctx context.Context, key string, obj interface{}) (err error)

func (*RedisClient) GetString

func (rc *RedisClient) GetString(ctx context.Context, key string) (result string, err error)

func (*RedisClient) SetObj

func (rc *RedisClient) SetObj(ctx context.Context, key string, value interface{}, expiration time.Duration) (err error)

func (*RedisClient) SetString

func (rc *RedisClient) SetString(ctx context.Context, key string, value interface{}, expiration time.Duration) (err error)

Jump to

Keyboard shortcuts

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