EdgeDoc
Features
Tech Specs
How-to C#
Pricing
Delete Cached Files
  |  
Home ›› XDoc.HTML5 Viewer ›› C# Viewer: Delete Cached Files

C# HTML5 Viewer: Delete Cached Files


Introduce Visual C#.NET Developers the Ways of Deleting Cache Files






RasterEdge XDoc.HTML5 Viewer Control for .NET provides C# developers with two ways to delete cache files, by controlling the time of deleting. Meanwhile, this feature is user-defined to be enabled or disabled in your C#.NET web document viewer.




C# Guide: Delete Cache Files for a Period of Time



The first way you can use in your C# web application is to clean up files in RasterEdge_ Cache folder every certain amount of time. IntervalTime is a class that defines this time interval. Here are some code snippets of Global.asax.




// Clean cache every 20 minites.
Scheduler.inervalJobTask = new IntervalJob(new IntervalTime(0, 0, 0, 20), directory);
Scheduler scheduler = new Scheduler();
System.Threading.ThreadStart myThreadStart = new System.Threading.ThreadStart(scheduler.IntervalJobStart);





C# Guide: Delete Cache Files for a Specific Time



Another way is to delete file after the same time. You may directly change the code as follows.




Scheduler scheduler = new Scheduler();
System.Threading.ThreadStart myThreadStart = new System.Threading.ThreadStart(scheduler.SameTimeJobStart);




And one additional thing you need to do is whenever locate a document in your C# project viewer, you should add the following code.




SameTimeJob job = new SameTimeJob(FileDirectory, fid, new IntervalTime(0,0,0,20));
lock (Scheduler.sameTimeJobList)
{
        Scheduler.sameTimeJobList.Add(job);
}





C# Guide: Disable Cache Deleting Feature



Of course, if you do not need this feature in your C# application, you can just comment out the following code in Global.asax to disable it.




// TimerTask();