Interface I_CmsImageCache

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
CmsFsImageCache, CmsRfsImageCache, CmsS3ImageCache

public interface I_CmsImageCache extends AutoCloseable
Storage for generated image cache entries.

  • Method Details

    • clear

      default void clear() throws Exception
      Clears all image cache entries.

      Throws:
      Exception - if clearing fails
    • close

      default void close() throws Exception
      Closes the image cache and releases associated resources.

      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception - if closing fails
    • exists

      boolean exists(String key) throws Exception
      Returns if the image cache entry exists.

      Parameters:
      key - the image cache key
      Returns:
      true if the image cache entry exists
      Throws:
      Exception - if the store access fails
    • existsAuthoritatively

      default boolean existsAuthoritatively(String key) throws Exception
      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:
      true if the image cache entry exists in the backing store
      Throws:
      Exception - if the store access fails
    • getLength

      long getLength(String key) throws Exception
      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

      Returns if range delivery is supported.

      Returns:
      true if ranges can be streamed
    • visitEntries

      Visits all image cache entries.

      Parameters:
      visitor - the image cache entry visitor
      Throws:
      Exception - if listing fails
    • visitEntries

      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 entries
      visitor - the image cache entry visitor
      Throws:
      Exception - if listing fails
    • write

      void write(String key, byte[] content) throws Exception
      Writes an image cache entry.

      Parameters:
      key - the image cache key
      content - the image cache content
      Throws:
      Exception - if writing fails
    • writeRangeTo

      void writeRangeTo(String key, long start, long length, OutputStream out) throws Exception
      Writes an image cache entry byte range to the output stream.

      Parameters:
      key - the image cache key
      start - the first byte to write
      length - the number of bytes to write
      out - the output stream
      Throws:
      Exception - if reading fails
    • writeTo

      void writeTo(String key, OutputStream out) throws Exception
      Writes an image cache entry to the output stream.

      Parameters:
      key - the image cache key
      out - the output stream
      Throws:
      Exception - if reading fails