xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-6ccedafe.md
Provides time settings to clean a cache for storing documents and reports.
Namespace : DevExpress.XtraReports.Web.WebDocumentViewer
Assembly : DevExpress.XtraReports.v25.2.Web.dll
NuGet Package : DevExpress.Web.Reporting.Common
public class CacheCleanerSettings :
StoragesCleanerSettingsBase
Public Class CacheCleanerSettings
Inherits StoragesCleanerSettingsBase
The following members return CacheCleanerSettings objects:
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.
Use the DefaultWebDocumentViewerContainer.Register<T, TImpl> method to register a new instance of the CacheCleanerSettings class with the different time settings.
The code below demonstrates how to register custom settings in a .NET Framework application. The settings force a document to live 1 minute in a client session while the report lives 120 minutes. The cleaner performs first check 30 seconds after start and checks the storage each minute.
using DevExpress.XtraReports.Web.WebDocumentViewer;
//...
void Application_Start(object sender, EventArgs e) {
var dueTime = TimeSpan.FromSeconds(30);
var period = TimeSpan.FromMinutes(1);
var reportTimeToLive = TimeSpan.FromHours(2);
var documentTimeToLive = TimeSpan.FromMinutes(1);
DefaultWebDocumentViewerContainer.RegisterSingleton<CacheCleanerSettings>(new CacheCleanerSettings(dueTime, period, reportTimeToLive, documentTimeToLive));
}
//...
Imports DevExpress.XtraReports.Web.WebDocumentViewer
'...
Sub Application_Start(sender As Object, e As EventArgs)
Dim dueTime = TimeSpan.FromSeconds(30)
Dim period = TimeSpan.FromMinutes(1)
Dim reportTimeToLive = TimeSpan.FromHours(2)
Dim documentTimeToLive = TimeSpan.FromMinutes(1)
DefaultWebDocumentViewerContainer.RegisterSingleton(Of CacheCleanerSettings)(New CacheCleanerSettings(dueTime, period, reportTimeToLive, documentTimeToLive))
End Sub
'...
Use the AddSingleton method to register a new instance of the CacheCleanerSettings class with the different time settings.
The code below demonstrates how to register custom settings in a .NET Framework application. The settings force a document to live 1 minute in a client session while the report lives 120 minutes. The cleaner performs first check 30 seconds after start and checks the storage each minute.
using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDevExpressControls();
builder.Services.AddMvc();
var dueTime = TimeSpan.FromSeconds(30);
var period = TimeSpan.FromMinutes(1);
var reportTimeToLive = TimeSpan.FromHours(2);
var documentTimeToLive = TimeSpan.FromMinutes(1);
builder.Services.AddSingleton<CacheCleanerSettings>(new CacheCleanerSettings(dueTime, period, reportTimeToLive, documentTimeToLive));
var app = builder.Build();
The default WebDocumentViewer storage for documents/exported documents/reports is the memory cache. If you enable the file-based storage, a copies of this resource will then be stored on the hard drive. These copies have their own individual expiration settings. The CacheCleanerSettings controls the in-memory copy, and the StorageCleanerSettings are applied to the storage copy. Call the following methods to enable file storage and use the StorageCleanerSettings:
|
ASP.NET Web Forms / ASP.NET MVC
|
ASP.NET Core
| | --- | --- | |
|
| |
|
| |
UseFileExportedDocumentStorage
|
UseFileExportedDocumentStorage
| |
|
|
Object DevExpress.XtraReports.Web.WebDocumentViewer.Native.Services.StoragesCleanerSettingsBase CacheCleanerSettings
See Also