redis

package
v0.0.0-...-2e9e358 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelCache

func DelCache(key string) error

func GetCache

func GetCache(key string) string

func InitRedis

func InitRedis(opts ...*ConnectOption)

func LockRun

func LockRun(lockerKey string, cb func(), timeoutSeconds int) error

func SetCache

func SetCache(key string, value string, timeout int) error

Types

type ConnectOption

type ConnectOption struct {
	Password string
	SrvHost  string
	SrvPort  string
	DbNum    int
}

func ConnectOptionFromProfile

func ConnectOptionFromProfile() *ConnectOption

type RedisCache

type RedisCache struct {
	// contains filtered or unexported fields
}

Cache is Redis cache adapter.

func RedisNewCache

func RedisNewCache(constr string, password string) *RedisCache

func (*RedisCache) Delete

func (rc *RedisCache) Delete(key string) error

Delete delete cache in redis.

func (*RedisCache) Get

func (rc *RedisCache) Get(key string) interface{}

Get cache from redis.

func (*RedisCache) IsExist

func (rc *RedisCache) IsExist(key string) bool

IsExist check cache's existence in redis.

func (*RedisCache) Put

func (rc *RedisCache) Put(key string, val interface{}, timeout time.Duration) error

Put put cache to redis.

Jump to

Keyboard shortcuts

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