LRUCache 的实现

📝

内容提要

刷 leetcode 的时候碰到的这道题。LRUCache 在现实中也经常用到: - 内存换页,需要淘汰掉不常用的 page。 - 缓存函数的结果,比如 Python 就自带的 lru_cache 的实现。 - redis 在设置了 maxmemory 时,在内存占用达到最大值时会通过 LRU 淘汰掉对应的 key。 Leetcode 题目要求如下 js / Design and

🏷️

标签

➡️

继续阅读