LRU 缓存
const cache = new LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1) // 返回 1
cache.put(3, 3) // 删除 key 2,因为容量已满
cache.get(2) // 返回 -1
const cache = new LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1) // 返回 1
cache.put(3, 3) // 删除 key 2,因为容量已满
cache.get(2) // 返回 -1