cache

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CONFIG = Redis{
	DB:       0,
	Addr:     "127.0.0.1:6379",
	Password: "",
	PoolSize: 0,
}
View Source
var ErrRedisInit = errors.New("缓存初始化失败")

Functions

func DeleteCache

func DeleteCache(key string) (int64, error)

DeleteCache 删除缓存数据

func GetCacheBytes

func GetCacheBytes(key string) ([]byte, error)

GetCacheBytes 获取bytes类型数据

func GetCacheString

func GetCacheString(key string) (string, error)

GetCacheString 获取字符串类型数据

func GetCacheUint

func GetCacheUint(key string) (uint64, error)

GetCacheUint 获取uint类型数据

func InitCache

func InitCache()

InitCache 初始化缓存

func InitConfig

func InitConfig() error

InitConfig 初始化 redis 配置

func Instance

func Instance() redis.UniversalClient

Instance 初始化缓存服务

func IsExist

func IsExist() bool

IsExist 配置文件是否存在

func Remove

func Remove() error

Remove 删除配置文件

func SetCache

func SetCache(key string, value interface{}, expiration time.Duration) error

SetCache 缓存数据

Types

type Redis

type Redis struct {
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
	Addr     string `mapstructure:"addr" json:"addr" yaml:"addr"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	PoolSize int    `mapstructure:"pool-size" json:"poolSize" yaml:"pool-size"`
}

Jump to

Keyboard shortcuts

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