Polish Javadoc in LRUCache

This commit is contained in:
Qimiao Chen 2020-04-01 11:25:43 +08:00 committed by GitHub
parent 70d7136fad
commit fa803c94cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,10 +62,14 @@ class LRUCache<K, V> extends LinkedHashMap<K, V> {
CACHE_SIZE = cacheSize;
}
/**
* 钩子方法通过put新增键值对的时候若该方法返回true
* 便移除该map中最老的键和值
*/
@Override
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
// 当 map中的数据量大于指定的缓存个数的时候就自动删除最老的数据。
return size() > CACHE_SIZE;
}
}
```
```