Update Java 容器.md
更正错别字 LUR 为LRU
This commit is contained in:
parent
4168b1ccab
commit
4b569bd08c
@ -1012,7 +1012,7 @@ protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
|
||||
以下是使用 LinkedHashMap 实现的一个 LRU 缓存:
|
||||
|
||||
- 设定最大缓存空间 MAX_ENTRIES 为 3;
|
||||
- 使用 LinkedHashMap 的构造函数将 accessOrder 设置为 true,开启 LUR 顺序;
|
||||
- 使用 LinkedHashMap 的构造函数将 accessOrder 设置为 true,开启 LRU 顺序;
|
||||
- 覆盖 removeEldestEntry() 方法实现,在节点多于 MAX_ENTRIES 就会将最近最久未使用的数据移除。
|
||||
|
||||
```java
|
||||
|
Loading…
x
Reference in New Issue
Block a user