Class CacheFacade
java.lang.Object
is.galia.cache.CacheFacade
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp()Cleans up all active caches.voidevict(Identifier identifier) Evicts all cached items associated with a source image from all caches.voidevict(OperationList opList) Evicts the given variant image from the variant cache.voidevictAsync(Identifier identifier) Invokesevict(Identifier)asynchronously.voidPurges all infos from theInfoCacheandHeapInfoCache.voidPurges all invalid content from all caches.fetchInfo(Identifier identifier) Returns theInfoof the source image corresponding to the given identifier.fetchOrReadInfo(Identifier identifier, Format format, Decoder decoder) Returns theInfoof the source image corresponding to the given identifier.longbooleanbooleanbooleannewVariantImageInputStream(OperationList opList, StatResult statResult) voidpurge()Purges all information from all caches.
-
Constructor Details
-
CacheFacade
public CacheFacade()
-
-
Method Details
-
cleanUp
-
evict
Evicts all cached items associated with a source image from all caches.- Throws:
IOException- See Also:
-
evict
Evicts the given variant image from the variant cache.- Throws:
IOException- See Also:
-
evictAsync
Invokesevict(Identifier)asynchronously. -
evictInfos
Purges all infos from theInfoCacheandHeapInfoCache.- Throws:
IOException- See Also:
-
evictInvalid
Purges all invalid content from all caches.- Throws:
IOException- See Also:
-
fetchInfo
Returns the
Infoof the source image corresponding to the given identifier.The following caches are consulted in order of preference:
- The
HeapInfoCache, if enabled by theKey.HEAP_INFO_CACHE_ENABLEDconfiguration key - The instance returned by
CacheFactory.getInfoCache()
If an info exists in a cache but is corrupt, the error is swallowed and logged and an empty instance is returned.
- Parameters:
identifier- Identifier of the source image for which to retrieve the info.- Returns:
- Info for the image with the given identifier.
- Throws:
IOException- If there is an error reading or writing to or from the cache.- See Also:
- The
-
fetchOrReadInfo
public Optional<Info> fetchOrReadInfo(Identifier identifier, Format format, Decoder decoder) throws IOException Returns the
Infoof the source image corresponding to the given identifier.The following sources are consulted in order of preference:
- The
HeapInfoCache, if enabled by theKey.HEAP_INFO_CACHE_ENABLEDconfiguration key; - The instance returned by
CacheFactory.getInfoCache(); - The given processor. If this is the case, it will also be cached in whichever of the above caches are available. (This may happen asynchronously.)
If an info exists in a cache but is corrupt, the error is swallowed and logged.
- Parameters:
identifier- Identifier of the source image for which to retrieve the info.format- Source image format.decoder- Instance to use to read the info if necessary.- Returns:
- Info for the image with the given identifier.
- Throws:
IOException- if there is an error reading or writing to or from the cache.- See Also:
- The
-
getHeapInfoCache
- Returns:
- The
HeapInfoCache, if it is enabled.
-
getHeapInfoCacheSize
public long getHeapInfoCacheSize()- Returns:
- Number of instances contained in the
HeapInfoCache, if enabled, or else0.
-
getInfoCache
-
getVariantCache
- Returns:
- The active
VariantCache, if one is enabled. - See Also:
-
isHeapInfoCacheEnabled
public boolean isHeapInfoCacheEnabled() -
isInfoCacheEnabled
public boolean isInfoCacheEnabled() -
isVariantCacheEnabled
public boolean isVariantCacheEnabled() -
newVariantImageInputStream
- Throws:
IOException- See Also:
-
newVariantImageInputStream
public InputStream newVariantImageInputStream(OperationList opList, StatResult statResult) throws IOException - Throws:
IOException- See Also:
-
newVariantImageOutputStream
- Throws:
IOException- See Also:
-
purge
Purges all information from all caches.- Throws:
IOException- See Also:
-