Package org.aksw.commons.util.cache
Class CacheView<KF,KB,V>
java.lang.Object
org.aksw.commons.util.cache.CacheView<KF,KB,V>
- Type Parameters:
KF- The frontend key typeKB- The backend key typeV- The value type
- All Implemented Interfaces:
com.google.common.cache.Cache<KF,V>
A view over a cache which can place 'local' keys into a shared cache.
For example, local keys could be offsets in a file, whereas global keys
include the file name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe delegate cacheA predicate that hides cache entries unrelated to this cache view. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMap()voidcleanUp()getAllPresent(Iterable<? extends Object> keys) getIfPresent(Object key) voidinvalidate(Object key) voidvoidinvalidateAll(Iterable<? extends Object> keys) voidvoidprotected KBsafeToBackend(KF key) longsize()com.google.common.cache.CacheStatsstats()
-
Field Details
-
backend
The delegate cache -
keyConverter
-
backendKeyFilter
A predicate that hides cache entries unrelated to this cache view. Note that every backend key derived from this view must succeed the filter. This means: backendFilter.test(keyMapper.convert(frontendKey)) must always evaluate to true.
-
-
Constructor Details
-
CacheView
-
-
Method Details
-
getBackend
-
safeToBackend
-
convert
-
getIfPresent
-
get
- Specified by:
getin interfacecom.google.common.cache.Cache<KF,KB> - Throws:
ExecutionException
-
getAllPresent
-
put
-
putAll
-
invalidate
-
invalidateAll
-
invalidateAll
public void invalidateAll() -
size
public long size() -
stats
public com.google.common.cache.CacheStats stats() -
asMap
-
cleanUp
public void cleanUp()
-