Package me.danwi.sqlex.common
Class LRUCache<K,V>
java.lang.Object
me.danwi.sqlex.common.LRUCache<K,V>
- Type Parameters:
K- key类型V- value类型
LRU缓存
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LRUCache
public LRUCache(int size) 新建LRU缓存- Parameters:
size- 缓存容量
-
-
Method Details
-
get
从缓存中取值,会刷新对应缓存的使用情况- Parameters:
key- 缓存key- Returns:
- key对应的缓存值, 如果不存在, 则返回null
-
set
将值放入缓存中- Parameters:
key- 缓存keyvalue- 缓存value
-