redis

package
v1.2.26 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

type Redis struct {
	Client func() *redis.Client
}

func (*Redis) CacheWithString

func (r *Redis) CacheWithString(key string, output interface{}, expire time.Duration, fn func() (interface{}, bool)) error

从String类型的缓存中读取数据,如没则重新调用指定方法重新从数据库中读取并写入缓存

func (*Redis) HGetAll

func (r *Redis) HGetAll(key string) (result []interface{})

func (*Redis) HMDel added in v1.2.0

func (r *Redis) HMDel(key string, fields ...string) error

func (*Redis) HMSet

func (r *Redis) HMSet(key string, data map[string]interface{}) error

func (*Redis) NewRedis

func (r *Redis) NewRedis(rdc *types.RedisCollector, cli *types.RedisClient, f func() *redis.Options) (*redis.Client, error)

func (*Redis) NoDataExpiration

func (r *Redis) NoDataExpiration() time.Duration

数据不存在情况下,为防止缓存雪崩,随机返回一个30到60秒的有效时间

Jump to

Keyboard shortcuts

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