Class GuavaCache<K,V>
java.lang.Object
com.github.javaparser.symbolsolver.cache.GuavaCache<K,V>
- Type Parameters:
K- The type of the key.V- The type of the value.
- All Implemented Interfaces:
Cache<K,V>
This class is used to wrap a Guava
Cache.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnsTrueif 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.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.voidAssociates value with key in this cache.voidDiscards any cached value for this key.voidDiscards all entries in the cache.longsize()Returns the number of entries in this cache.
-
Constructor Details
-
GuavaCache
-
-
Method Details
-
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
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
Description copied from interface:CacheReturns the value associated withkeyin this cache, or empty if there is no cached value forkey. -
remove
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
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.
-