Package org.opencms.loader
Class CmsFsImageCache
java.lang.Object
org.opencms.loader.CmsRfsImageCache
org.opencms.loader.CmsFsImageCache
- All Implemented Interfaces:
AutoCloseable,I_CmsImageCache
File system based storage for generated image cache entries.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencms.loader.I_CmsImageCache
I_CmsImageCache.I_CmsImageCacheEntryVisitor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all image cache entries.voidclose()Closes the image cache and releases associated resources.booleanReturns if the image cache entry exists.longReturns the image cache entry length.protected PathReturns the cache path for a key.voidInvalidates locally cached metadata for an image cache entry.voidvisitEntries(String prefix, I_CmsImageCache.I_CmsImageCacheEntryVisitor visitor) Visits image cache entries whose normalized keys start with the given prefix.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.Methods inherited from class org.opencms.loader.CmsRfsImageCache
getRepository, getRepositoryPath, initRepository, supportsRangeDeliveryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencms.loader.I_CmsImageCache
existsAuthoritatively
-
Constructor Details
-
CmsFsImageCache
Creates a new FS image cache.- Parameters:
path- the file system path- Throws:
Exception- if the path can not be initialized
-
-
Method Details
-
clear
Description copied from interface:I_CmsImageCacheClears all image cache entries.- Specified by:
clearin interfaceI_CmsImageCache- Overrides:
clearin classCmsRfsImageCache- Throws:
Exception- if clearing fails- See Also:
-
close
Description copied from interface:I_CmsImageCacheCloses the image cache and releases associated resources.- Throws:
Exception- if closing fails- See Also:
-
exists
Description copied from interface:I_CmsImageCacheReturns if the image cache entry exists.- Specified by:
existsin interfaceI_CmsImageCache- Overrides:
existsin classCmsRfsImageCache- Parameters:
key- the image cache key- Returns:
trueif the image cache entry exists- Throws:
Exception- if the store access fails- See Also:
-
getLength
Description copied from interface:I_CmsImageCacheReturns the image cache entry length.- Specified by:
getLengthin interfaceI_CmsImageCache- Overrides:
getLengthin classCmsRfsImageCache- Parameters:
key- the image cache key- Returns:
- the image cache entry length
- Throws:
Exception- if the store access fails- See Also:
-
invalidateLocalMetadata
Invalidates locally cached metadata for an image cache entry.This is used after maintenance operations which modify the shared file system outside the regular cache access path.
- Parameters:
key- the image cache key
-
visitEntries
Description copied from interface:I_CmsImageCacheVisits all image cache entries.- Specified by:
visitEntriesin interfaceI_CmsImageCache- Overrides:
visitEntriesin classCmsRfsImageCache- Parameters:
visitor- the image cache entry visitor- Throws:
Exception- if listing fails- See Also:
-
visitEntries
public void visitEntries(String prefix, I_CmsImageCache.I_CmsImageCacheEntryVisitor visitor) throws Exception Description copied from interface:I_CmsImageCacheVisits 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
I_CmsImageCache.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- See Also:
-
write
Description copied from interface:I_CmsImageCacheWrites an image cache entry.- Specified by:
writein interfaceI_CmsImageCache- Overrides:
writein classCmsRfsImageCache- Parameters:
key- the image cache keycontent- the image cache content- Throws:
Exception- if writing fails- See Also:
-
writeRangeTo
Description copied from interface:I_CmsImageCacheWrites an image cache entry byte range to the output stream.- Specified by:
writeRangeToin interfaceI_CmsImageCache- Overrides:
writeRangeToin classCmsRfsImageCache- 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- See Also:
-
writeTo
Description copied from interface:I_CmsImageCacheWrites an image cache entry to the output stream.- Specified by:
writeToin interfaceI_CmsImageCache- Overrides:
writeToin classCmsRfsImageCache- Parameters:
key- the image cache keyout- the output stream- Throws:
Exception- if reading fails- See Also:
-
getPath
Returns the cache path for a key.- Parameters:
key- the image cache key- Returns:
- the cache path
-