Documentation ¶
Index ¶
- type Cache
- func (c *Cache) Cap() int
- func (c *Cache) Contains(key interface{}) bool
- func (c *Cache) Get(key interface{}) (interface{}, bool)
- func (c *Cache) GetOldest() (key, value interface{}, ok bool)
- func (c *Cache) Keys() []interface{}
- func (c *Cache) Len() int
- func (c *Cache) Peek(key interface{}) (interface{}, bool)
- func (c *Cache) Purge()
- func (c *Cache) Put(key interface{}, value interface{}) bool
- func (c *Cache) Remove(key string) bool
- func (c *Cache) RemoveOldest() (key, value interface{}, ok bool)
- func (c *Cache) Resize(size int) int
- type Entry
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
}
LRU缓存 https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
func (*Cache) RemoveOldest ¶
删除最老的的key-value,并返回
Click to show internal directories.
Click to hide internal directories.