Documentation ¶
Index ¶
- type Cache
- func (c *Cache) Capacity() int
- func (c *Cache) Close() error
- func (c *Cache) Delete(key string) error
- func (c *Cache) Get(key string) (string, error)
- func (c *Cache) Iterator() *EntryInfoIterator
- func (c *Cache) Len() int
- func (c *Cache) Reset() error
- func (c *Cache) Set(key, value string) error
- func (c *Cache) Stats() States
- type Config
- type EntryInfoIterator
- type States
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
}
func GetMemoryCache ¶
func GetMemoryCache() *Cache
func (*Cache) Iterator ¶
func (c *Cache) Iterator() *EntryInfoIterator
type Config ¶
type Config struct { Shards int `json:"shards" yaml:"shards"` //存储的条目数量,值必须是2的幂 LifeWindow time.Duration `json:"lifeWindow" yaml:"lifeWindow"` //超时后条目被删除 MaxEntriesInWindow int `json:"maxEntriesInWindow" yaml:"maxEntriesInWindow"` //在 Life Window 中的最大数量 MaxEntrySize int `json:"maxEntrySize" yaml:"maxEntrySize"` //条目最大尺寸,以字节为单位 HardMaxCacheSize int `json:"hardMaxCacheSize" yaml:"hardMaxCacheSize"` //设置缓存最大值,以MB为单位,超过了不在分配内存。0表示无限制分配 CleanWindow time.Duration `json:"cleanWindow" yaml:"cleanWindow"` //过期时间 }
type EntryInfoIterator ¶
type EntryInfoIterator = bigcache.EntryInfoIterator //bigcache迭代器
Click to show internal directories.
Click to hide internal directories.