K - the type of (wrapped) keys for this cacheV - the type of values retrieved by this cacheCachingProcessor instead@ThreadSafe @Deprecated public final class ProcessingCache<K,V> extends Object
Processors
This is a wrapper over Guava's LoadingCache to which you pass
two arguments:
Equivalence on cache keys,CacheLoader to load keys.Note that the cache loader must throw a ProcessingException
or any subclass.
You can of course use Guava's builtin equivalences if you don't wish (or need) to write your own:
Equivalence.equals() for the classical equals/hashcode key
comparison,Equivalence.identity() for a reference equality comparison
(useful if you use enums or classes as keys, for instance).Note that there is one major difference with Guava's caches: this cache does not accept null keys.
LoadingCache,
Equivalence,
Equivalence.Wrapper| Constructor and Description |
|---|
ProcessingCache(Equivalence<K> equivalence,
CacheLoader<Equivalence.Wrapper<K>,V> cacheLoader)
Deprecated.
Constructor
|
public ProcessingCache(Equivalence<K> equivalence, CacheLoader<Equivalence.Wrapper<K>,V> cacheLoader)
equivalence - the equivalencecacheLoader - the cache loader functionProcessorBuildError - either the equivalence or the cache loader
is nullpublic V get(K key) throws ProcessingException
key - the keyProcessingException - error when computing the valueProcessingError - key is nullpublic V getUnchecked(K key)
Exceptions are not really ignored per se. You can use this method
instead of get(Object) if you are sure that no exceptions can
be thrown.
If an exception is thrown nevertheless, it will be an unchecked exception.
key - the keyProcessingError - key is nullCopyright © 2013. All Rights Reserved.