Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { // optional and executed when an entry is purged. OnEvicted func(key string, value Value) // 某条记录被移除时的回调函数,可以为 nil // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access. 创建一个包含字典和双向链表的结构体类型 Cache,方便实现后续的增删查改操作
func (*Cache) RemoveOldest ¶
func (c *Cache) RemoveOldest()
RemoveOldest removes the oldest item 这里的删除,实际上是缓存淘汰。即移除最近最少访问的节点(队首)
Click to show internal directories.
Click to hide internal directories.