Class CacheFacade
java.lang.Object
is.galia.cache.CacheFacade
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanUp()
Cleans up all active caches.void
evict
(Identifier identifier) Evicts all cached items associated with a source image from all caches.void
evict
(OperationList opList) Evicts the given variant image from the variant cache.void
evictAsync
(Identifier identifier) Invokesevict(Identifier)
asynchronously.void
Purges all infos from theInfoCache
andHeapInfoCache
.void
Purges all invalid content from all caches.fetchInfo
(Identifier identifier) Returns theInfo
of the source image corresponding to the given identifier.fetchOrReadInfo
(Identifier identifier, Format format, Decoder decoder) Returns theInfo
of the source image corresponding to the given identifier.long
boolean
boolean
boolean
newVariantImageInputStream
(OperationList opList, StatResult statResult) void
purge()
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 theInfoCache
andHeapInfoCache
.- Throws:
IOException
- See Also:
-
evictInvalid
Purges all invalid content from all caches.- Throws:
IOException
- See Also:
-
fetchInfo
Returns the
Info
of 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_ENABLED
configuration 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
Info
of 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_ENABLED
configuration 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:
-