Package com.jayway.jsonpath.spi.cache
Class LRUCache
- java.lang.Object
-
- com.jayway.jsonpath.spi.cache.LRUCache
-
-
Constructor Summary
Constructors Constructor Description LRUCache(int limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddKey(java.lang.String key)JsonPathget(java.lang.String key)Get the Cached JsonPathJsonPathgetSilent(java.lang.String key)voidput(java.lang.String key, JsonPath value)Add JsonPath to the cachevoidremove(java.lang.String key)private voidremoveFirstOccurrence(java.lang.String key)private java.lang.StringremoveLast()private voidremoveThenAddKey(java.lang.String key)intsize()java.lang.StringtoString()
-
-
-
Field Detail
-
lock
private final java.util.concurrent.locks.ReentrantLock lock
-
map
private final java.util.Map<java.lang.String,JsonPath> map
-
queue
private final java.util.Deque<java.lang.String> queue
-
limit
private final int limit
-
-
Method Detail
-
put
public void put(java.lang.String key, JsonPath value)Description copied from interface:CacheAdd JsonPath to the cache
-
get
public JsonPath get(java.lang.String key)
Description copied from interface:CacheGet the Cached JsonPath
-
addKey
private void addKey(java.lang.String key)
-
removeLast
private java.lang.String removeLast()
-
removeThenAddKey
private void removeThenAddKey(java.lang.String key)
-
removeFirstOccurrence
private void removeFirstOccurrence(java.lang.String key)
-
getSilent
public JsonPath getSilent(java.lang.String key)
-
remove
public void remove(java.lang.String key)
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-