Documentation ¶
Index ¶
- Variables
- func Register(name string, store StoreInterface)
- type Cache
- func (c *Cache) Clear() error
- func (c *Cache) Delete(key string) error
- func (c *Cache) Forever(key string, value interface{}) error
- func (c *Cache) Get(key string) (interface{}, error)
- func (c *Cache) GetStoreName() string
- func (c *Cache) GetTTl(key string) (time.Time, error)
- func (c *Cache) Has(key string) error
- func (c *Cache) Set(key string, value interface{}, time int) error
- func (c *Cache) Size() int
- type StoreInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var Stores = make(map[string]StoreInterface)
Functions ¶
Types ¶
type StoreInterface ¶
type StoreInterface interface { GetStoreName() string // 获取缓存 Get(key string) (interface{}, error) // 设置缓存带过期时间 Set(key string, value interface{}, time int) error // 设置永久缓存无过期时间 Forever(key string, value interface{}) error // 删除key Delete(key string) error // 判断key是否存在 Has(key string) error // 全部清空 Clear() error // 获取缓存key的数量 Size() int // 获取expire GetTTl(key string) (time.Time, error) // 随机删除已过期key GC() }
Click to show internal directories.
Click to hide internal directories.