public class CacheKeys extends Object
The class allows you to generate cache keys based on different parameters, such as the document path, rendering options, and resource name. These cache keys can be used to store and retrieve cached data for efficient document rendering.
Example usage:
// Generate a cache key for a file
String fileKey = CacheKeys.getFileKey("filename.pdf");
// Generate a cache key for a page
String pageKey = CacheKeys.getPageKey(pageNumber, FileType.HTML.getExtension());
// Generate a cache key for a resource
Resource resource = new Resource("styles.css", false);
String pageKey = CacheKeys.getResourceKey(pageNumber, resource);
| Modifier and Type | Field and Description |
|---|---|
static String |
PAGE_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
static String |
getAttachmentKey(String attachmentId)
Retrieves the unique identifier for the cache entry representing an attachment file.
|
static String |
getAttachmentsKey()
Returns the unique identifier for the cache entry that represents a collection of
Attachment objects. |
static String |
getFileInfoKey()
Retrieves the unique identifier for the cache entry that represents a
ViewInfo object. |
static String |
getFileKey(String extension)
Retrieves the unique identifier for the cache entry that represents a file.
|
static String |
getPageKey(int pageNumber,
String extension)
Retrieves the unique identifier for the cache entry that represents a page file.
|
static String |
getResourceFilter(int pageNumber)
Returns a filter string to search for cache entries that represent
Resource objects. |
static String |
getResourceKey(int pageNumber,
Resource resource)
Returns a unique identifier for the cache entry that represents a
Resource object. |
static String |
getViewInfoKey()
Retrieves the unique identifier for the cache entry that represents a
ViewInfo object. |
public static final String PAGE_NUMBER
public static String getAttachmentKey(String attachmentId)
Retrieves the unique identifier for the cache entry representing an attachment file.
attachmentId - The unique identifier of the attachment (in the context of a single file).IllegalArgumentException - If the attachmentId is null or empty.Attachmentpublic static String getAttachmentsKey()
Returns the unique identifier for the cache entry that represents a collection of Attachment objects.
public static String getFileInfoKey()
Retrieves the unique identifier for the cache entry that represents a ViewInfo object.
public static String getFileKey(String extension)
Retrieves the unique identifier for the cache entry that represents a file.
extension - The filename suffix (including the period ".") e.g. ".doc".IllegalArgumentException - Thrown when extension is null or empty.public static String getPageKey(int pageNumber, String extension)
Retrieves the unique identifier for the cache entry that represents a page file.
pageNumber - The number of the page.extension - The filename suffix (including the period ".") e.g. ".doc".IllegalArgumentException - Thrown when pageNumber is less than or equal to zero.IllegalArgumentException - Thrown when extension is null or empty.public static String getResourceFilter(int pageNumber)
Returns a filter string to search for cache entries that represent Resource objects.
pageNumber - The number of the page.IllegalArgumentException - Thrown when pageNumber is less than or equal to zero.public static String getResourceKey(int pageNumber, Resource resource)
Returns a unique identifier for the cache entry that represents a Resource object.
pageNumber - The number of the page.resource - The HTML resource.IllegalArgumentException - Thrown when pageNumber is less than or equal to zero.IllegalArgumentException - Thrown when resource is null.ResourceCopyright © 2025. All rights reserved.