cache

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PREFIX = "#"
	KEY_PP = "PP"
)

Variables

View Source
var (
	TtlPP = time.Second * time.Duration(600)
)

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 `yaml:"Engine"`
	Host     string `yaml:"Host"`
	Port     string `yaml:"Port"`
	Pass     string `yaml:"Pass"`
	DB       int    `yaml:"DB"`
	LifeTime int64  `yaml:"LifeTime"`
}

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