cache

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const MaxAgeValue = -1

MaxAgeValue 最大存放期限,无限期

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{}, bool)
	Remove(id string)
	ClearAll()
	Release()
}

Cache 缓存对象

func NewCache

func NewCache() Cache

NewCache 创建Cache对象

type KVCache

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

KVCache 缓存对象

func NewKVCache

func NewKVCache() KVCache

NewKVCache 创建Cache对象

type MemoryCache

type MemoryCache chan commandData

MemoryCache 内存缓存

func (*MemoryCache) ClearAll

func (right *MemoryCache) ClearAll()

ClearAll 清除所有数据

func (*MemoryCache) Fetch

func (right *MemoryCache) Fetch(id string) (interface{}, bool)

Fetch 获取数据

func (*MemoryCache) Put

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

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

func (*MemoryCache) Release

func (right *MemoryCache) Release()

Release 释放Cache

func (*MemoryCache) Remove

func (right *MemoryCache) Remove(id string)

Remove 清除数据

type MemoryKVCache

type MemoryKVCache chan commandData

MemoryKVCache 内存缓存

func (*MemoryKVCache) ClearAll

func (right *MemoryKVCache) ClearAll()

ClearAll 清除所有数据

func (*MemoryKVCache) Fetch

func (right *MemoryKVCache) Fetch(key string) (interface{}, bool)

Fetch 获取数据

func (*MemoryKVCache) GetAll

func (right *MemoryKVCache) GetAll() (ret []string)

GetAll 获取所有的数据

func (*MemoryKVCache) Put

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

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

func (*MemoryKVCache) Release

func (right *MemoryKVCache) Release()

Release 释放Cache

func (*MemoryKVCache) Remove

func (right *MemoryKVCache) Remove(key string)

Remove 清除数据

Jump to

Keyboard shortcuts

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