Free Support Forum - groupdocs.com

CustomCacheDataHandler Sample

Hi,

we use groupdocs-viewer 3.2.2 for Java and try to create a custom CacheDataHandler using your sample https://github.com/groupdocs-lisbon/groupdocs-viewer-java-sample/blob/master/src/main/java/com/groupdocs/viewer/sample/handler/AmazonS3CacheDataHandler.java But the used import path “com.groupdocs.viewer.common” isn’t available in this release. Is there a sample implementation for current version 3.2.2 ?

Hi There,


Thanks for showing your interest in GroupDocs.Viewer for Java 3.x and posting the query.
Please go through the following official GroupDocs.Viewer for Java resources (examples and documentation) and share your experience:

Example Project - GitHub Example Project
GroupDocs.Viewer for Java Documentation - API Wiki

Best Wishes



Greetings,


Thanks for sharing your experience with us.
used import path “com.groupdocs.viewer.common” isn’t available in this release
We would like to apprise you that these imports are available/resolved in next release of the API and the release is expected within few days.
We shall surely notify you about it. Please stay tuned.

Kind regards

Hi,

thanks for your answer - i’ve already looked at the samples you provided, but the only sample implementation for ICacheDataHandler was found on the github project mentioned above. Is there any further information for ICacheDataHandler? Using a few workarounds, IInputDataHandler works for us!

Hi,



thank you - please also verify, we get a valid lastmodificationdate on overriding getOutputSaveStream. Attached you see the FileInfo data file and a screenshot from the cachedatahandler call.



Regards

Hi There,


Thanks for providing us the relevant files. We shall surely investigate your scenario and let you know about the outcomes.

Thanks

Hi There,


we get a valid lastmodificationdate
Please let us know, are you getting expected lastmodificationdate value from the application?

Thanks
Greetings,

We would like to tell you that the description.getLastModificationDate() is last modification date of cached file that getOutputSaveStream method creates and which doesn't exist at that moment. On the other hand, the last modification date stored in fd.xml is last modification date of the original file in storage. Please use current date instead of description.getLastModificationDate() as modification date for CacheFile:
Like this,

Date now = new Date();
CacheFile file = new CacheFile();
file.setModificationDate(now);

Hope it will resolve your issue.
Many Thanks

Hi,



as you can the lastmodification date in fd.xml and in the attribute CacheFileDescription are different for the “same” file.



Kind regards

Hi,

ok i thought the lastmodificationdate is used to verify if the generated image in the cache belongs to the a specific version of a file.

So if a file changes, the lastmodificationdate of the file is different to filedata lastmodificationdate. in this case, all previews are generated and no outdated cached preview is used? how do i clear outdated previews from cache?



Kind Regards, Josef

Hello,


Thanks for the prompt response.
We have logged your issue in our internal issue tracking system with the ID:VIEWERJAVA-1312, as we get any update from the concerned team, we shall surely update you. Please stay tuned.

Thanks

Hi Josef,


As you are using GroupDocs.Viewer for Java 3.2.2, cache clearing functionality is not supported in this version.
We would recommend you to upgrade to GroupDocs.Viewer for Java 3.7.0. Please download this latest release of the API and then you can clear cache like this,

//Clear files from cache
handler.clearCache();

Please go through following resources:
Documentation - Clearing Cache
Example Project - GitHub Source Code

It will surely help you.
Best Wishes