Class CacheResource

java.lang.Object
io.goobi.viewer.api.rest.v1.cache.CacheResource

@Path("/cache") public class CacheResource extends Object
REST resource providing cache management endpoints for content and image server caches.
  • Constructor Details

    • CacheResource

      public CacheResource()
  • Method Details

    • getCacheInfo

      @GET @Produces("application/json") public String getCacheInfo() throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentServerCacheException
      Reports which of the content, PDF and thumbnail caches are enabled and their current status.

      A cache is included only if its useCache attribute (on contentCache, thumbnailCache or pdfCache) is enabled in the content server configuration; a cache whose status cannot be serialized to JSON is skipped and logged instead of failing the whole request. Every included cache is returned as an entry under the same "content" JSON key, each entry carrying its own cache name to identify which cache it describes.

      Returns:
      JSON object describing the enabled caches
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentServerCacheException - if a cache cannot be queried
    • clearCache

      @DELETE @Produces("application/json") public IResponseMessage clearCache(@QueryParam("content") boolean content, @QueryParam("thumbs") boolean thumbs, @QueryParam("pdf") boolean pdf)
      Empties the main image, thumbnail and PDF caches for all records.

      Each cache is cleared independently according to its query parameter; a cache whose flag is false is left untouched.

      Parameters:
      content - if true, clears the main image content cache
      thumbs - if true, clears the thumbnail cache
      pdf - if true, clears the PDF cache
      Returns:
      IResponseMessage
    • clearCacheForRecord

      @DELETE @Path("/{pi}") @Produces("application/json") public IResponseMessage clearCacheForRecord(@PathParam("pi") String pi, @QueryParam("content") boolean content, @QueryParam("thumbs") boolean thumbs, @QueryParam("pdf") boolean pdf) throws IOException
      Clears the cache entries for a single record, matched by key prefix, and reports how many entries were removed.
      Parameters:
      pi - persistent identifier of the record whose cache entries are deleted
      content - if true, clears the main image content cache for the record
      thumbs - if true, clears the thumbnail cache for the record
      pdf - if true, clears the PDF cache and download jobs for the record
      Returns:
      IResponseMessage
      Throws:
      IOException