Free Support Forum - groupdocs.com

Clear Temporary Files from Document Viewer


#1

Hii ,


First of all i would like to give thanx to Mr. Pavel for giving quick response with proper solution.
I need one more help from Groupdocs people .let me explain my requirements .

I want to clear temporary files each time from Groupdocs Viewer application because it creates problem if all files are stored in temporary folder then it will badly hamper in server loading when more than lakh files will be previewed and annotated .So Please give me any solution for this.

#2
Hello ,

Thanks for your posting and using GroupDocs.Viewer.

Please check our documentation for DocumentCache here .

Please notify us if you still have any questions .

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

Hii,

Here is my code written inside pageload action of Controller because i have to clear temp files before loading so plz check and inform me where i am doing fault so that files are not removed from temporary folder .please have a look and reply me as soon as possible its urgent.

DocumentCache s1 = new DocumentCache("~/GroupDocs.Viewer.lic", “~/localfiles/”,workingDirectoryPath:null);
s1.RemoveOldEntries(new TimeSpan(2,1,1), @“c:\GDViewerTmp\cache_clean_log.txt”);


#4
Hello,

Thanks for your inquiry and using the GroupDocs.Viewer.

We have checked the scenario and found out some bugs in it . Please try to use this updated code

DocumentCache s1 = new DocumentCache(Server.MapPath("~/GroupDocs.Viewer.lic"), Server.MapPath("~/testfiles/"));
s1.RemoveOldEntries(new TimeSpan(2, 1, 1), @"c:\GDViewerTmp\cache_clean_log.txt");

If the GroupDocs.Viewer will find some old files, older than 2 hours 1 minutes 1 seconds (new TimeSpan(2, 1, 1)) you will see in the cache_clean_log.txt file such lines .

If you will have more questions please feel free to contact us

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#5

Thnx for reply.


#6

Hi Evgen,


This is a good feature. I actually did create my own custom deletion process. Our system uses both the viewer, compare, and annotation. Each has it’s own timing on when the files can be deleted. If I use this in viewer, will it also deletes annotation and compare files?


Thanks.


Leo

#7

Hii ,

I want to clear files which are stored in APP Data folder after PDF annotation.I had implemented above code .“Files are removed” text written in Cache_clean_log file but files are not deleted from temp folder. Please suggest me where i am implemented wrongly.

Please go through below code:

DocumentCache s1 = new DocumentCache(Server.MapPath("~/GroupDocs.Viewer.lic"), Server.MapPath("~/testfiles/"));

s1.RemoveOldEntries(new TimeSpan(0, 5, 0), @“c:\GDViewerTmp\cache_clean_log.txt”);




#8

Hi Leo,


Thank you the question. If you mean that one call of this feature will delete temp files from all three locations in same time - then no, it will delete only temp files from the folder which you set in the second parameter of the DocumentCache object. The best way to achieve your goal is to create a function which will accept folder path in which it should remove temp files as a parameter and inside the function put your deletion code. Then simply call this function in the different places with different path.

Best regards.

#9

Hello,


Thank you for your request. If you want to delete cache from App_Data folder then you should set this folder here:
DocumentCache s1 = new DocumentCache(Server.MapPath("~/GroupDocs.Viewer.lic"), Server.MapPath("~/testfiles/"));

instead of "testfiles"

Best regards.

#10

Ok.

Thanks, Pavel.

This is what I was thinking as well.

Regards,

Leo


#11

Hello Pavel,

Thnx for reply. I checked already by writing following code .But its not working .

DocumentCache s1 = new DocumentCache(Server.MapPath("~/GroupDocs.Viewer.lic"), Server.MapPath("~/App_Data/temp/"));


#12

Hi Leo,


You are welcome.

Best regards.

#13

Hi again,


Sorry but this variant is wrong too. If you will take a look at the parameters which DocumentCache class accepts - you will see that the second parameter is the root storage path, since that you should set there only: Server.MapPath("~/App_Data")

Best regards.

#14

Hello again,


Thnx for reply. it works fine.

#15

Hello,


Glad to hear that.

Best regards.