cache

package
v0.0.0-...-114c9fd Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IceCacheManager

type IceCacheManager struct {
	MaxSize    uint32           // 缓存最大容量,单位为MB
	ExpireTime uint32           // 缓存过期时间,单位为秒
	Cache      *freecache.Cache // 缓存实例
}

IceCacheManager Iceinu的缓存管理器实例,实现了一系列的缓存管理方法,便于直接使用

func NewIceCacheManager

func NewIceCacheManager(maxSize, expireTime uint32) *IceCacheManager

NewIceCacheManager 创建新的缓存管理器实例

func (*IceCacheManager) Clear

func (icm *IceCacheManager) Clear()

Clear 清空缓存

func (*IceCacheManager) Del

func (icm *IceCacheManager) Del(key string)

Del 删除缓存数据

func (*IceCacheManager) Get

func (icm *IceCacheManager) Get(key string, value interface{}) error

Get 获取缓存数据,value 必须是指针类型以便解码后进行填充

func (*IceCacheManager) GetCache

func (icm *IceCacheManager) GetCache() *freecache.Cache

GetCache 直接获取缓存实例

func (*IceCacheManager) GetExpireTime

func (icm *IceCacheManager) GetExpireTime() uint32

GetExpireTime 获取缓存过期时间

func (*IceCacheManager) GetMaxSize

func (icm *IceCacheManager) GetMaxSize() uint32

GetMaxSize 获取缓存最大容量

func (*IceCacheManager) Set

func (icm *IceCacheManager) Set(key string, value interface{}) error

Set 设置缓存数据

func (*IceCacheManager) SetWithExpire

func (icm *IceCacheManager) SetWithExpire(key string, value interface{}, expire int) error

SetWithExpire 设置缓存数据并同时指定过期时间

func (*IceCacheManager) Update

func (icm *IceCacheManager) Update(key string, value interface{}) error

Update 更新缓存数据

Jump to

Keyboard shortcuts

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