public class OffHeapLoadingCache<K,V> extends Object implements LoadingCache<K,V>
Constructor and Description |
---|
OffHeapLoadingCache(double maxStoreSize,
long maxEntriesSize,
long expireAfterWrite,
long expireAfterAccess) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Clean the used resources of the cache.
|
boolean |
equals(Object o) |
V |
get(K key,
Callable<? extends V> valueLoader)
Returns the value associated with
key in this cache, obtaining that value from
valueLoader if necessary. |
Map<K,V> |
getAllPresent(Iterable<K> keys)
Returns a map of the values associated with
keys in this cache. |
V |
getIfPresent(K key) |
LookupCacheStats |
getStats() |
int |
hashCode() |
void |
invalidate(K key)
Discards any cached value for key
key . |
void |
invalidateAll()
Clears the contents of the cache.
|
void |
invalidateAll(Iterable<K> keys)
Discards any cached values for keys
keys . |
boolean |
isClosed() |
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to the cache.
|
public OffHeapLoadingCache(double maxStoreSize, long maxEntriesSize, long expireAfterWrite, long expireAfterAccess)
public V getIfPresent(K key)
getIfPresent
in interface LoadingCache<K,V>
key
- must not be null
Returns the value associated with key
in this cache, or null
if there is no
cached value for key
.
a cache miss should be counted if the key is missing.public Map<K,V> getAllPresent(Iterable<K> keys)
LoadingCache
keys
in this cache. The returned map will
only contain entries which are already present in the cache.getAllPresent
in interface LoadingCache<K,V>
public V get(K key, Callable<? extends V> valueLoader) throws ExecutionException
LoadingCache
key
in this cache, obtaining that value from
valueLoader
if necessary. No observable state associated with this cache is modified
until loading completes.
Warning: as with CacheLoader.load(K)
, valueLoader
must not return
null
; it may either return a non-null value or throw an exception.
get
in interface LoadingCache<K,V>
ExecutionException
- if a checked exception was thrown while loading the valuepublic void putAll(Map<? extends K,? extends V> m)
LoadingCache
putAll
in interface LoadingCache<K,V>
public void invalidate(K key)
LoadingCache
key
. Eviction can be lazy or eager.invalidate
in interface LoadingCache<K,V>
public void invalidateAll(Iterable<K> keys)
LoadingCache
keys
. Eviction can be lazy or eager.invalidateAll
in interface LoadingCache<K,V>
public void invalidateAll()
LoadingCache
invalidateAll
in interface LoadingCache<K,V>
public LookupCacheStats getStats()
getStats
in interface LoadingCache<K,V>
public boolean isClosed()
isClosed
in interface LoadingCache<K,V>
public void close()
LoadingCache
close
in interface LoadingCache<K,V>
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2011–2017. All rights reserved.