public class WeakRefVolatileLoaderCache<K,V> extends Object implements VolatileLoaderCache<K,V>
defaultParallelismThreshold
Constructor and Description |
---|
WeakRefVolatileLoaderCache(LoaderCache<K,V> backingCache,
BlockingFetchQueues<Callable<?>> fetchQueue) |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
Remove entries from the cache whose references have been
garbage-collected.
|
V |
get(K key,
VolatileCacheLoader<? super K,? extends V> loader,
CacheHints hints) |
V |
getIfPresent(Object key,
CacheHints hints) |
void |
invalidate(K key)
Removes and discards the entry with the specified
key . |
void |
invalidateAll(long parallelismThreshold)
Removes and discards all entries.
|
void |
invalidateIf(long parallelismThreshold,
Predicate<K> condition)
Removes and discards all entries with keys matching
condition . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withLoader
invalidateAll, invalidateIf
public WeakRefVolatileLoaderCache(LoaderCache<K,V> backingCache, BlockingFetchQueues<Callable<?>> fetchQueue)
public V getIfPresent(Object key, CacheHints hints) throws ExecutionException
getIfPresent
in interface AbstractVolatileCache<K,V>
ExecutionException
public V get(K key, VolatileCacheLoader<? super K,? extends V> loader, CacheHints hints) throws ExecutionException
get
in interface VolatileLoaderCache<K,V>
ExecutionException
public void cleanUp()
public void invalidate(K key)
AbstractVolatileCache
key
. Calls
CacheRemover.invalidate(Object)
for the discarded entry, (which
should in turn remove it from any backing cache)
Note that this will not call
CacheRemover.onRemoval(Object, Object)
for the discarded entry.
There must be no concurrent get()
operations for key
.
This may result in cache corruption and/or a deadlock.
invalidate
in interface Invalidate<K>
invalidate
in interface AbstractVolatileCache<K,V>
key
- key of the entry to removepublic void invalidateIf(long parallelismThreshold, Predicate<K> condition)
AbstractVolatileCache
condition
.
Calls Invalidate.invalidateIf(Predicate)
for the discarded
entries, (which should in turn remove them from any backing cache)
Note that this will not call
CacheRemover.onRemoval(Object, Object)
for the discarded entries.
There must be no concurrent get()
operations for keys
matching condition
. This may result in cache corruption and/or a
deadlock.
invalidateIf
in interface Invalidate<K>
invalidateIf
in interface AbstractVolatileCache<K,V>
parallelismThreshold
- the (estimated) number of entries in the cache needed for this
operation to be executed in parallelcondition
- condition on keys of entries to removepublic void invalidateAll(long parallelismThreshold)
AbstractVolatileCache
Invalidate.invalidateAll()
(which should in turn invalidate any
backing cache)
Note that this will not call
CacheRemover.onRemoval(Object, Object)
for the discarded entries.
There must be no concurrent get()
operations. This may
result in cache corruption and/or a deadlock.
invalidateAll
in interface Invalidate<K>
invalidateAll
in interface AbstractVolatileCache<K,V>
parallelismThreshold
- the (estimated) number of entries in the cache needed for this
operation to be executed in parallelCopyright © 2015–2022 ImgLib2. All rights reserved.