cache

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	IsOK() error
	Get(key string, data interface{}) error
	Delete(key string) error
	Set(key string, value interface{}, expire time.Duration) error
	EnQueue(key string, value interface{}) error
	DeQueue(key string) (interface{}, error)
}

Cache

type Config

type Config struct {
	Engine   string `toml:"engine"`
	Host     string `toml:"host"`
	Port     string `toml:"port"`
	Pass     string `toml:"pass"`
	DB       int    `toml:"db"`
	LifeTime int64  `toml:"life_time"`
}

Redis Config

type Redis

type Redis struct {
	Client *redis.Client
}

Redis client

func NewRedis

func NewRedis(config Config) *Redis

NewRedis 实例化一个redis缓存

func (*Redis) DeQueue

func (r *Redis) DeQueue(key string) (interface{}, error)

DeQueue

func (*Redis) Delete

func (r *Redis) Delete(key string) error

Delete

func (*Redis) EnQueue

func (r *Redis) EnQueue(key string, value interface{}) error

EnQueue

func (*Redis) Get

func (r *Redis) Get(key string, data interface{}) error

Get

func (*Redis) IsOK

func (r *Redis) IsOK() error

IsOK pings the redis server and check server's pong response

func (*Redis) Set

func (r *Redis) Set(key string, value interface{}, expire time.Duration) error

Set

Jump to

Keyboard shortcuts

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