hcache

package
v0.0.0-...-1e877d2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

key/value 内存缓存,支持基于超时的自动无效功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyCache

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

func OnGetCache

func OnGetCache(cachename string) (mc MyCache)

初始化一个cache cachename 缓存名字

func (*MyCache) Add

func (mc *MyCache) Add(key interface{}, value interface{}, lifeSpan time.Duration) *cache2go.CacheItem

添加一个缓存 lifeSpan:缓存时间,0表示永不超时

func (*MyCache) Clear

func (mc *MyCache) Clear() bool

清空表內容

func (*MyCache) Delete

func (mc *MyCache) Delete(key interface{}) error

删除一个cache

func (*MyCache) GetCache2go

func (mc *MyCache) GetCache2go() *cache2go.CacheTable

获取原始cache2go操作类

func (*MyCache) IsExist

func (mc *MyCache) IsExist(key interface{}) bool

判断key是否存在

func (*MyCache) Value

func (mc *MyCache) Value(key interface{}) (value interface{}, b bool)

Jump to

Keyboard shortcuts

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