public interface Cache
The Cache interface defines the methods required for storing rendered documents and document resources cache in the GroupDocs.Viewer component. It provides a contract for implementing different cache mechanisms to enhance the performance of document rendering by caching frequently accessed data.
Example usage:
// Implement a custom cache by implementing the Cache interface
public class MyCustomCache implements Cache {
// Implement the methods of the Cache interface based on your caching mechanism
// ...
}
// Create an instance of your custom cache
Cache myCache = new MyCustomCache();
final ViewerSettings viewerSettings = new ViewerSettings();
// Set the custom cache to viewerSettings
viewerSettings.setCache(myCache);
// Use the viewerSettings object for creating Viewer object to render document with custom cache
try (Viewer viewer = new Viewer(documentPath, viewerSettings)) {
// Use the viewer object for document rendering
}
Note: The Cache interface allows you to implement custom cache mechanisms tailored to your specific requirements.
GroupDocs.Viewer also provides built-in cache implementation such as FileCache.
Viewer,
ViewerSettings,
FileCache| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(String key,
Class<T> clazz)
Retrieves the entry associated with the specified key if it is present, and returns null otherwise.
|
List<String> |
getKeys(String filter)
Returns all keys that match the specified filter.
|
void |
set(String key,
Object value)
Inserts a cache entry into the cache.
|
<T> T get(String key, Class<T> clazz)
Retrieves the entry associated with the specified key if it is present, and returns null otherwise.
key - A key identifying the requested entry.clazz - The class type of the expected entry.List<String> getKeys(String filter)
Returns all keys that match the specified filter.
filter - The filter to use.Copyright © 2024. All rights reserved.