rediscache

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

采用json进行序列化的的cache

func NewCache

func NewCache(addrs []string, pref string, expire int) *Cache

redis 地址列表,key前缀,过期时间

func (*Cache) Del

func (m *Cache) Del(key string) error

func (*Cache) Get

func (m *Cache) Get(key string, data CacheData) error

func (*Cache) GetCache

func (m *Cache) GetCache(key string, data CacheData) error

func (*Cache) Set

func (m *Cache) Set(key string, data CacheData) error

不会自动load

type CacheData

type CacheData interface {
	// 序列化接口
	Marshal() ([]byte, error)
	// 反序列化接口
	Unmarshal([]byte) error
	// cache miss load数据接口
	Load(key string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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