CacheKeys
Leave feedback
On this page
Inheritance: java.lang.Object
public class CacheKeys
Provides methods to retrieve the unique identifier for a cache entry.
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);
| Field | Description |
|---|---|
| PAGE_NUMBER |
| Method | Description |
|---|---|
| getAttachmentsKey() | Returns the unique identifier for the cache entry that represents a collection of Attachment objects. |
| getAttachmentKey(String attachmentId) | Retrieves the unique identifier for the cache entry representing an attachment file. |
| getViewInfoKey() | Retrieves the unique identifier for the cache entry that represents a ViewInfo object. |
| getFileInfoKey() | Retrieves the unique identifier for the cache entry that represents a ViewInfo object. |
| getFileKey(String extension) | Retrieves the unique identifier for the cache entry that represents a file. |
| getPageKey(int pageNumber, String extension) | Retrieves the unique identifier for the cache entry that represents a page file. |
| getResourceKey(int pageNumber, Resource resource) | Returns a unique identifier for the cache entry that represents a Resource object. |
| getResourceFilter(int pageNumber) | Returns a filter string to search for cache entries that represent Resource objects. |
public static final String PAGE_NUMBER
public static String getAttachmentsKey()
Returns the unique identifier for the cache entry that represents a collection of Attachment objects.
Returns: java.lang.String - the unique identifier for the attachments cache entry.
public static String getAttachmentKey(String attachmentId)
Retrieves the unique identifier for the cache entry representing an attachment file.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| attachmentId | java.lang.String | The unique identifier of the attachment (in the context of a single file). |
Returns: java.lang.String - the unique identifier for the attachment file cache entry.
public static String getViewInfoKey()
Retrieves the unique identifier for the cache entry that represents a ViewInfo object.
Returns: java.lang.String - the unique identifier for the cache entry.
public static String getFileInfoKey()
Retrieves the unique identifier for the cache entry that represents a ViewInfo object.
Returns: java.lang.String - the unique identifier for the cache entry representing a ViewInfo object.
public static String getFileKey(String extension)
Retrieves the unique identifier for the cache entry that represents a file.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| extension | java.lang.String | The filename suffix (including the period “.”) e.g. “.doc”. |
Returns: java.lang.String - the unique identifier for the cache entry representing a file.
public static String getPageKey(int pageNumber, String extension)
Retrieves the unique identifier for the cache entry that represents a page file.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pageNumber | int | The number of the page. |
| extension | java.lang.String | The filename suffix (including the period “.”) e.g. “.doc”. |
Returns: java.lang.String - the unique identifier for the cache entry representing a page file.
public static String getResourceKey(int pageNumber, Resource resource)
Returns a unique identifier for the cache entry that represents a Resource object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pageNumber | int | The number of the page. |
| resource | Resource | The HTML resource. |
Returns: java.lang.String - the unique identifier for the cache entry.
public static String getResourceFilter(int pageNumber)
Returns a filter string to search for cache entries that represent Resource objects.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pageNumber | int | The number of the page. |
Returns: java.lang.String - the filter string to search for cache entries.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.