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 void
addKey(java.lang.String key)
JsonPath
get(java.lang.String key)
Get the Cached JsonPathJsonPath
getSilent(java.lang.String key)
void
put(java.lang.String key, JsonPath value)
Add JsonPath to the cachevoid
remove(java.lang.String key)
private void
removeFirstOccurrence(java.lang.String key)
private java.lang.String
removeLast()
private void
removeThenAddKey(java.lang.String key)
int
size()
java.lang.String
toString()
-
-
-
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:Cache
Add JsonPath to the cache
-
get
public JsonPath get(java.lang.String key)
Description copied from interface:Cache
Get 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:
toString
in classjava.lang.Object
-
-