Versions in this module Expand all Collapse all v0 v0.0.2 Mar 30, 2025 v0.0.1 Mar 28, 2025 Changes in this version + const DataEmpty + func CheckDataEmpty(data string) bool + func Get(ctx context.Context, key interface{}) (*vvar.Var, error) + func GetOrSet(ctx context.Context, key interface{}, value interface{}, ...) (*vvar.Var, error) + func Set(ctx context.Context, key interface{}, value interface{}, ...) error + func Update(ctx context.Context, key interface{}, value interface{}) (oldValue *vvar.Var, exist bool, err error) + type ILocalCache interface + Get func(ctx context.Context, key interface{}) (*vvar.Var, error) + Set func(ctx context.Context, key interface{}, value interface{}, ...) error + func NewLocalCache() ILocalCache + type IRedisCache interface + Del func(ctx context.Context, keys ...string) (int64, error) + ExpireNX func(ctx context.Context, key string, duration time.Duration) (bool, error) + Get func(ctx context.Context, key string) (string, error) + HDel func(ctx context.Context, key string, fields ...string) (int64, error) + HGet func(ctx context.Context, key string, field string) (string, error) + HGetAll func(ctx context.Context, key string) (map[string]string, error) + HSet func(ctx context.Context, key string, values ...interface{}) (int64, error) + Lock func(ctx context.Context, lockName string, duration time.Duration) (res bool, err error) + SAdd func(ctx context.Context, key string, members ...interface{}) (int64, error) + SPop func(ctx context.Context, key string) (string, error) + Set func(ctx context.Context, key string, value interface{}, duration time.Duration) (string, error) + SetNX func(ctx context.Context, key string, value interface{}, duration time.Duration) (bool, error) + Unlock func(ctx context.Context, lockName string) (int64, error) + func NewRedisCache(p RedisCacheParam) IRedisCache + type LocalCache struct + func (r *LocalCache) Get(ctx context.Context, key interface{}) (*vvar.Var, error) + func (r *LocalCache) Set(ctx context.Context, key interface{}, value interface{}, ...) error + type RedisCache struct + Redis *vredis.Redis + func (r *RedisCache) Del(ctx context.Context, keys ...string) (int64, error) + func (r *RedisCache) ExpireNX(ctx context.Context, key string, duration time.Duration) (bool, error) + func (r *RedisCache) Get(ctx context.Context, key string) (string, error) + func (r *RedisCache) HDel(ctx context.Context, key string, fields ...string) (int64, error) + func (r *RedisCache) HGet(ctx context.Context, key string, field string) (string, error) + func (r *RedisCache) HGetAll(ctx context.Context, key string) (map[string]string, error) + func (r *RedisCache) HSet(ctx context.Context, key string, values ...interface{}) (int64, error) + func (r *RedisCache) Lock(ctx context.Context, lockName string, duration time.Duration) (res bool, err error) + func (r *RedisCache) SAdd(ctx context.Context, key string, members ...interface{}) (int64, error) + func (r *RedisCache) SPop(ctx context.Context, key string) (string, error) + func (r *RedisCache) Set(ctx context.Context, key string, value interface{}, duration time.Duration) (string, error) + func (r *RedisCache) SetNX(ctx context.Context, key string, value interface{}, duration time.Duration) (bool, error) + func (r *RedisCache) Unlock(ctx context.Context, lockName string) (int64, error) + type RedisCacheParam struct + Redis *vredis.Redis