Class CacheResource
java.lang.Object
io.goobi.viewer.api.rest.v1.cache.CacheResource
REST resource providing cache management endpoints for content and image server caches.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclearCache(boolean content, boolean thumbs, boolean pdf) Empties the main image, thumbnail and PDF caches for all records.clearCacheForRecord(String pi, boolean content, boolean thumbs, boolean pdf) Clears the cache entries for a single record, matched by key prefix, and reports how many entries were removed.Reports which of the content, PDF and thumbnail caches are enabled and their current status.
-
Constructor Details
-
CacheResource
public CacheResource()
-
-
Method Details
-
getCacheInfo
@GET @Produces("application/json") public String getCacheInfo() throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentServerCacheExceptionReports 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
falseis left untouched.- Parameters:
content- if true, clears the main image content cachethumbs- if true, clears the thumbnail cachepdf- 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 deletedcontent- if true, clears the main image content cache for the recordthumbs- if true, clears the thumbnail cache for the recordpdf- if true, clears the PDF cache and download jobs for the record- Returns:
IResponseMessage- Throws:
IOException
-