| Constructor and Description |
|---|
GuavaCache(com.google.common.cache.Cache<K,V> guavaCache) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(K key)
Returns
True if the cache contains a entry with the key,
or False if there is none. |
static <expectedK,expectedV> |
create(com.google.common.cache.Cache<expectedK,expectedV> guavaCache)
Wrap a Guava cache with a custom cache.
|
Optional<V> |
get(K key)
Returns the value associated with
key in this cache,
or empty if there is no cached value for key. |
boolean |
isEmpty()
Returns
True if the cache is empty, or False
if there's at least a entry stored in cache. |
void |
put(K key,
V value)
Associates value with key in this cache.
|
void |
remove(K key)
Discards any cached value for this key.
|
void |
removeAll()
Discards all entries in the cache.
|
long |
size()
Returns the number of entries in this cache.
|
public static <expectedK,expectedV> GuavaCache<expectedK,expectedV> create(com.google.common.cache.Cache<expectedK,expectedV> guavaCache)
expectedK - The expected type for the key.expectedV - The expected type for the value.guavaCache - The guava cache to be wrapped-NoCache.public void put(K key, V value)
Cachepublic Optional<V> get(K key)
Cachekey in this cache,
or empty if there is no cached value for key.public void remove(K key)
Cachepublic void removeAll()
Cachepublic boolean contains(K key)
CacheTrue if the cache contains a entry with the key,
or False if there is none.public long size()
CacheCopyright © 2007–2023. All rights reserved.