cache

package
v1.3.122 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const ForeverAgeValue = -1

ForeverAgeValue 最大存放期限,无限期

View Source
const HalfHourAgeValue = 30
View Source
const OneMinuteAgeValue = 1
View Source
const TenMinutesAgeValue = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// maxAge单位minute
	Put(data interface{}, maxAge float64) string
	Fetch(id string) interface{}
	Search(opr SearchOpr) interface{}
	Remove(id string)
	ClearAll()
	Release()
}

Cache 缓存对象

func NewCache

func NewCache(cleanCallBack CleanCallBackFunc) Cache

NewCache 创建Cache对象

type CleanCallBackFunc added in v1.3.24

type CleanCallBackFunc func(string)

type KVCache

type KVCache interface {
	// Put maxAge单位minute
	Put(key string, data interface{}, maxAge float64) string
	Fetch(key string) interface{}
	Search(opr SearchOpr) interface{}
	Remove(key string)
	GetAll() []interface{}
	ClearAll()
	Release()
}

KVCache 缓存对象

func NewKVCache

func NewKVCache(cleanCallBack CleanCallBackFunc) KVCache

NewKVCache 创建Cache对象

type MemoryCache

type MemoryCache chan commandData

MemoryCache 内存缓存

func (*MemoryCache) ClearAll

func (s *MemoryCache) ClearAll()

ClearAll 清除所有数据

func (*MemoryCache) Fetch

func (s *MemoryCache) Fetch(id string) interface{}

Fetch 获取数据

func (*MemoryCache) Put

func (s *MemoryCache) Put(data interface{}, maxAge float64) string

Put 投放数据,返回数据的唯一标示

func (*MemoryCache) Release

func (s *MemoryCache) Release()

Release 释放Cache

func (*MemoryCache) Remove

func (s *MemoryCache) Remove(id string)

Remove 清除数据

func (*MemoryCache) Search added in v1.2.7

func (s *MemoryCache) Search(opr SearchOpr) interface{}

type MemoryKVCache

type MemoryKVCache chan commandData

MemoryKVCache 内存缓存

func (*MemoryKVCache) ClearAll

func (s *MemoryKVCache) ClearAll()

ClearAll 清除所有数据

func (*MemoryKVCache) Fetch

func (s *MemoryKVCache) Fetch(key string) interface{}

Fetch 获取数据

func (*MemoryKVCache) GetAll

func (s *MemoryKVCache) GetAll() (ret []interface{})

GetAll 获取所有的数据

func (*MemoryKVCache) Put

func (s *MemoryKVCache) Put(key string, data interface{}, maxAge float64) string

Put 投放数据,返回数据的唯一标示

func (*MemoryKVCache) Release

func (s *MemoryKVCache) Release()

Release 释放Cache

func (*MemoryKVCache) Remove

func (s *MemoryKVCache) Remove(key string)

Remove 清除数据

func (*MemoryKVCache) Search added in v1.2.7

func (s *MemoryKVCache) Search(opr SearchOpr) interface{}

type SearchOpr added in v1.2.7

type SearchOpr func(val interface{}) bool

Jump to

Keyboard shortcuts

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