cache

package
v0.0.0-...-bf04ae1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobal

func SetGlobal(c ICache)

SetGlobal 设置全局缓存

Types

type ICache

type ICache interface {
	ListKey(*ListKeyRequest) (*ListKeyResponse, error)
	//SetDefaultTTL 设置默认TTL时间戳
	SetDefaultTTL(ttl time.Duration)
	//Put set cached value with key and expire time.
	Put(key string, val interface{}) error
	//PutWithTTL set cached value with key and expire time.
	PutWithTTL(key string, val interface{}, ttl time.Duration) error
	//Get 返回缓存中Key指定的Value
	Get(key string, val interface{}) error
	//Delete 删除缓冲区Key指定的Value.
	Delete(key string) error
	//IsExist 检测指定Key的Value再缓冲区中是否存在.
	IsExist(key string) bool
	//Clear 清除所有缓存.
	Clear() error
	//Incr 按键增加缓存的int值,作为计数器.
	Incr(key string) error
	//Decr 按键减少缓存的int值,作为计数器.
	Decr(key string) error
	//Close 关闭缓存.
	Close() error
	//WithContext 设置上下文
	WithContext(ctx context.Context) ICache
}

ICache provides the interface for cache implementations.

func Instance

func Instance() ICache

Instance 全局缓存对象, 默认使用

type ListKeyRequest

type ListKeyRequest struct {
	*request.PageRequest
	// contains filtered or unexported fields
}

ListKeyRequest ...

func (*ListKeyRequest) Pattern

func (req *ListKeyRequest) Pattern() string

Pattern ...

type ListKeyResponse

type ListKeyResponse struct {
	Keys  []string
	Total uint64
}

ListKeyResponse ...

func NewListKeyResponse

func NewListKeyResponse(keys []string, total uint64) *ListKeyResponse

NewListKeyResponse 实例化ListKeyResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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