Class GuavaCache<K,V>
- java.lang.Object
-
- com.github.javaparser.symbolsolver.cache.GuavaCache<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.cache.Cache<K,V>guavaCache
-
Constructor Summary
Constructors Constructor Description GuavaCache(com.google.common.cache.Cache<K,V> guavaCache)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(K key)ReturnsTrueif the cache contains a entry with the key, orFalseif there is none.static <expectedK,expectedV>
GuavaCache<expectedK,expectedV>create(com.google.common.cache.Cache<expectedK,expectedV> guavaCache)Wrap a Guava cache with a custom cache.java.util.Optional<V>get(K key)Returns the value associated withkeyin this cache, or empty if there is no cached value forkey.booleanisEmpty()ReturnsTrueif the cache is empty, orFalseif there's at least a entry stored in cache.voidput(K key, V value)Associates value with key in this cache.voidremove(K key)Discards any cached value for this key.voidremoveAll()Discards all entries in the cache.longsize()Returns the number of entries in this cache.CacheStatsstats()Returns a current snapshot of this cache's cumulative statistics, or a set of default values if the cache is not recording statistics.
-
-
-
Method Detail
-
create
public static <expectedK,expectedV> GuavaCache<expectedK,expectedV> create(com.google.common.cache.Cache<expectedK,expectedV> guavaCache)
Wrap a Guava cache with a custom cache.- Type Parameters:
expectedK- The expected type for the key.expectedV- The expected type for the value.- Parameters:
guavaCache- The guava cache to be wrapped-- Returns:
- A newly created instance of
NoCache.
-
put
public void put(K key, V value)
Description copied from interface:CacheAssociates value with key in this cache.
If the cache previously contained a value associated with key, the old value is replaced by value.
-
get
public java.util.Optional<V> get(K key)
Description copied from interface:CacheReturns the value associated withkeyin this cache, or empty if there is no cached value forkey.
-
remove
public void remove(K key)
Description copied from interface:CacheDiscards any cached value for this key.
-
removeAll
public void removeAll()
Description copied from interface:CacheDiscards all entries in the cache.
-
contains
public boolean contains(K key)
Description copied from interface:CacheReturnsTrueif the cache contains a entry with the key, orFalseif there is none.
-
size
public long size()
Description copied from interface:CacheReturns the number of entries in this cache.
-
isEmpty
public boolean isEmpty()
Description copied from interface:CacheReturnsTrueif the cache is empty, orFalseif there's at least a entry stored in cache.
-
stats
public CacheStats stats()
Description copied from interface:CacheReturns a current snapshot of this cache's cumulative statistics, or a set of default values if the cache is not recording statistics. All statistics begin at zero and never decrease over the lifetime of the cache.
-
-