Defines methods required for storing rendered documents and document resources 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.