CacheCleanerSettings Class

Provides time settings to clean a cache for storing documents and reports.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v19.2.Web.dll

Declaration

public class CacheCleanerSettings :
    StoragesCleanerSettingsBase
Public Class CacheCleanerSettings
    Inherits StoragesCleanerSettingsBase

Remarks

The cleaner service periodically searches the cache and file storage for expired documents/exported documents/reports and deletes them. You can use the CacheCleanerSettings and StorageCleanerSettings to specify check interval and expiration time settings. To prevent expired documents from being deleted, call the UseEmptyStoragesCleaner() method to register an empty storage cleaner.

Settings in a .NET Framework Application

Use the DefaultWebDocumentViewerContainer.Register<T, TImpl> method to register a new instance of the CacheCleanerSettings class with the different time settings.

The following code demonstrates how to register custom settings in a .NET Framework application. The settings forces a document, report and exported document to live 30 seconds in cache. The cleaner performs first check 30 seconds after start and checks the storage each 30 seconds.

using DevExpress.XtraReports.Web.WebDocumentViewer;
//... 
  void Application_Start(object sender, EventArgs e) {
    var dueTime = TimeSpan.FromSeconds(30);
    var period = TimeSpan.FromSeconds(30);
    var reportTimeTolive = TimeSpan.FromSeconds(30);
    var documentTimeToLive = TimeSpan.FromSeconds(30);
    DefaultWebDocumentViewerContainer.RegisterSingleton<CacheCleanerSettings>(new CacheCleanerSettings(dueTime, period, reportTimeTolive, documentTimeToLive));
  }
//...

Settings in a .NET Core Application

Use the AddSingleton method to register a new instance of the StorageCleanerSettings class with the different time settings.

The following code demonstrates how to register custom settings in a .NET Core application. The settings forces a document, report and exported document to live 30 seconds in cache. The cleaner performs first check 30 seconds after start and checks the storage each 30 seconds.

using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
//... 

public class Startup {
//... 
  public void ConfigureServices(IServiceCollection services) {
    services.AddDevExpressControls();
    services.AddMvc(); 

    var dueTime = TimeSpan.FromSeconds(30);
    var period = TimeSpan.FromSeconds(30);
    var reportTimeTolive = TimeSpan.FromSeconds(30);
    var documentTimeToLive = TimeSpan.FromSeconds(30);
    services.AddSingleton<CacheCleanerSettings>(new CacheCleanerSettings(dueTime, period, reportTimeTolive, documentTimeToLive));
    });        
  }
//...    
}
NOTE

The default WebDocumentViewer storage for documents/exported documents/reports is the memory cache. Call the following methods to enable file storage and use the StorageCleanerSettings:

ASP.NET WebForms / ASP.NET MVC

ASP.NET Core

UseEmptyStoragesCleaner()

UseEmptyStoragesCleaner()

UseFileDocumentStorage

UseFileDocumentStorage

UseFileExportedDocumentStorage

UseFileExportedDocumentStorage

UseFileReportStorage

UseFileReportStorage

Inheritance

Object
DevExpress.XtraReports.Web.WebDocumentViewer.Native.Services.StoragesCleanerSettingsBase
CacheCleanerSettings
See Also