Package org.opencms.loader
Interface I_CmsImageCache
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
CmsFsImageCache,CmsRfsImageCache,CmsS3ImageCache
Storage for generated image cache entries.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceVisitor for image cache entries. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclear()Clears all image cache entries.default voidclose()Closes the image cache and releases associated resources.booleanReturns if the image cache entry exists.default booleanPerforms an authoritative existence check which does not rely on locally cached positive metadata.longReturns the image cache entry length.booleanReturns if range delivery is supported.default voidvisitEntries(String prefix, I_CmsImageCache.I_CmsImageCacheEntryVisitor visitor) Visits image cache entries whose normalized keys start with the given prefix.default voidVisits all image cache entries.voidWrites an image cache entry.voidwriteRangeTo(String key, long start, long length, OutputStream out) Writes an image cache entry byte range to the output stream.voidwriteTo(String key, OutputStream out) Writes an image cache entry to the output stream.
-
Method Details
-
clear
Clears all image cache entries.- Throws:
Exception- if clearing fails
-
close
Closes the image cache and releases associated resources.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- if closing fails
-
exists
Returns if the image cache entry exists.- Parameters:
key- the image cache key- Returns:
trueif the image cache entry exists- Throws:
Exception- if the store access fails
-
existsAuthoritatively
Performs an authoritative existence check which does not rely on locally cached positive metadata.This is used for requests which do not read the cache entry body and can therefore not detect a stale positive existence result while streaming. Implementations without a positive metadata cache can use the default implementation.
- Parameters:
key- the image cache key- Returns:
trueif the image cache entry exists in the backing store- Throws:
Exception- if the store access fails
-
getLength
Returns the image cache entry length.- Parameters:
key- the image cache key- Returns:
- the image cache entry length
- Throws:
Exception- if the store access fails
-
supportsRangeDelivery
boolean supportsRangeDelivery()Returns if range delivery is supported.- Returns:
trueif ranges can be streamed
-
visitEntries
Visits all image cache entries.- Parameters:
visitor- the image cache entry visitor- Throws:
Exception- if listing fails
-
visitEntries
default void visitEntries(String prefix, I_CmsImageCache.I_CmsImageCacheEntryVisitor visitor) throws Exception Visits image cache entries whose normalized keys start with the given prefix.Implementations with a prefix-aware storage backend should override this method to apply the prefix while listing. The default implementation filters the result of
visitEntries(I_CmsImageCacheEntryVisitor).- Parameters:
prefix- the image cache key prefix, or an empty string for all entriesvisitor- the image cache entry visitor- Throws:
Exception- if listing fails
-
write
Writes an image cache entry.- Parameters:
key- the image cache keycontent- the image cache content- Throws:
Exception- if writing fails
-
writeRangeTo
Writes an image cache entry byte range to the output stream.- Parameters:
key- the image cache keystart- the first byte to writelength- the number of bytes to writeout- the output stream- Throws:
Exception- if reading fails
-
writeTo
Writes an image cache entry to the output stream.- Parameters:
key- the image cache keyout- the output stream- Throws:
Exception- if reading fails
-