cache

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 12 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

func GetCacheString

func GetCacheString(key string) (string, error)

GetCacheString

func GetCacheUint

func GetCacheUint(key string) (uint64, error)

GetCacheUint

func InitConfig

func InitConfig() error

InitConfig initialize redis's config file

func Instance

func Instance() redis.UniversalClient

Instance get instance

func IsExist

func IsExist() bool

IsExist config file is exist

func Recover added in v1.2.0

func Recover() error

Recover

func Remove

func Remove() error

Remove remove config file

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:"pool-size" yaml:"pool-size"`
}

Jump to

Keyboard shortcuts

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