cache

package
v1.19.22 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 2 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobal added in v0.3.1

func SetGlobal(c Cache)

SetGlobal 设置全局缓存

Types

type Cache

type Cache interface {
	ListKey(*ListKeyRequest) (*ListKeyResponse, error)
	// SetTTL set default ttl
	SetDefaultTTL(ttl time.Duration)
	// set cached value with key and expire time.
	Put(key string, val interface{}) error
	// set cached value with key and expire time.
	PutWithTTL(key string, val interface{}, ttl time.Duration) error
	// get cached value by key.
	Get(key string, val interface{}) error
	// delete cached value by key.
	Delete(key string) error
	// check if cached value exists or not.
	IsExist(key string) bool
	// clear all cache.
	ClearAll() error
	// increase cached int value by key, as a counter.
	Incr(key string) error
	// decrease cached int value by key, as a counter.
	Decr(key string) error
	// close cache
	Close() error
}

Cache provides the interface for cache implementations.

func C added in v0.3.1

func C() Cache

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

type ListKeyRequest added in v0.5.1

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

ListKeyRequest todo

func NewListKeyRequest added in v0.5.1

func NewListKeyRequest(pattern string, ps uint, pn uint) *ListKeyRequest

NewListKeyRequest todo

func (*ListKeyRequest) Pattern added in v0.5.1

func (req *ListKeyRequest) Pattern() string

Pattern tood

type ListKeyResponse added in v0.5.1

type ListKeyResponse struct {
	Keys  []string
	Total uint64
}

ListKeyResponse todo

func NewListKeyResponse added in v0.5.1

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

NewListKeyResponse todo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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