若是設計一個LRU(最少訪問次數)

LRU 是 Least Recently Used 的簡寫,字面意思則是最近最少使用。一般用於緩存的淘汰策略實現,因爲緩存的內存很是寶貴,因此須要根據某種規則來剔除數據保證內存不被撐滿。java public class LRUCache { private Map<Integer, int[]> cache = null; private int capacity = 0;
相關文章
相關標籤/搜索