Documentation ¶
Overview ¶
key/value 内存缓存,支持基于超时的自动无效功能
Index ¶
- type CacheIFS
- type MyCache
- func (mc *MyCache) Add(key interface{}, value interface{}, lifeSpan time.Duration) error
- func (mc *MyCache) Clear() error
- func (mc *MyCache) Close() error
- func (mc *MyCache) Delete(key interface{}) error
- func (mc *MyCache) Destory()
- func (mc *MyCache) GetCache2go() *cache2go.CacheTable
- func (mc *MyCache) GetKeyS(key interface{}) ([]string, error)
- func (mc *MyCache) IsExist(key interface{}) bool
- func (mc *MyCache) Refresh(key interface{}, lifeSpan time.Duration) error
- func (mc *MyCache) TryLock(key interface{}, value interface{}, lifeSpan time.Duration) (err error)
- func (mc *MyCache) Unlock(key interface{}) (err error)
- func (mc *MyCache) Value(key interface{}, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheIFS ¶
type CacheIFS interface { Destory() // 析构 Add(key interface{}, value interface{}, lifeSpan time.Duration) error // 添加一个元素 Value(key interface{}, value interface{}) error // 获取一个value IsExist(key interface{}) bool // 判断是否存在 Delete(key interface{}) error // 删除一个 Clear() error // 清空 Close() (err error) // 关闭连接 TryLock(key interface{}, value interface{}, lifeSpan time.Duration) (err error) // 试着加锁 Unlock(key interface{}) (err error) // 解锁 GetKeyS(key interface{}) ([]string, error) // 查询所有key Refresh(key interface{}, lifeSpan time.Duration) error // 更新时间 }
CacheIFS 缓存操作接口
type MyCache ¶
type MyCache struct {
// contains filtered or unexported fields
}
MyCache 内存缓存
func (*MyCache) GetCache2go ¶
func (mc *MyCache) GetCache2go() *cache2go.CacheTable
GetCache2go 获取原始cache2go操作类
Click to show internal directories.
Click to hide internal directories.