| Modifier and Type | Method and Description |
|---|---|
static <K,V> ILRUCache<K,V> |
createCache(int capacity,
com.google.common.cache.Weigher<K,V> weigher) |
long |
getApproximateMemoryUsage() |
V |
getIfPresent(K key)
Get a value from cache if present (already loaded)
|
void |
invalidateAll()
Discards all entries in the cache.
|
V |
load(K key,
Callable<V> loader)
Get cached valued by key or load and cache loaded value.
|
public static <K,V> ILRUCache<K,V> createCache(int capacity, com.google.common.cache.Weigher<K,V> weigher)
public V load(K key, Callable<V> loader) throws ExecutionException
ILRUCacheload in interface ILRUCache<K,V>key - cache keyloader - key value loaderExecutionException - if load has any exception.public long getApproximateMemoryUsage()
getApproximateMemoryUsage in interface ILRUCache<K,V>public V getIfPresent(K key)
ILRUCachegetIfPresent in interface ILRUCache<K,V>key - cache keypublic void invalidateAll()
ILRUCacheinvalidateAll in interface ILRUCache<K,V>Copyright © 2011–2020. All rights reserved.