Class InMemoryCache<K,V>
- java.lang.Object
-
- com.github.javaparser.symbolsolver.cache.InMemoryCache<K,V>
-
- Type Parameters:
K
- The type of the key.V
- The type of the value.
- All Implemented Interfaces:
Cache<K,V>
public class InMemoryCache<K,V> extends Object implements Cache<K,V>
A cache implementation that stores the information in memory.
The current implementation stores the values in memory in aWeakHashMap
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(K key)
static <expectedK,expectedV>
InMemoryCache<expectedK,expectedV>create()
Create a new instance for a cache in memory.Optional<V>
get(K key)
boolean
isEmpty()
void
put(K key, V value)
void
remove(K key)
void
removeAll()
long
size()
CacheStats
stats()
-
-
-
Method Detail
-
create
public static <expectedK,expectedV> InMemoryCache<expectedK,expectedV> create()
Create a new instance for a cache in memory.- Type Parameters:
expectedK
- The expected type for the key.expectedV
- The expected type for the value.- Returns:
- A newly created instance of
InMemoryCache
.
-
stats
public CacheStats stats()
-
-