一个 LRU 缓存, 小堆维护过期时间, 链表维护最近访问数据, Map 提供随机访问能力
type (
pointer uint32
bucket struct {
Map *Map
Heap *Heap
List *List
}
Map map[string]pointer
Heap []pointer
List []Element
Element struct {
ptr, prev, next pointer
Key string
Val any
}
)