Skip to main content
All docs
V23.2

WebDocumentViewerConfigurationBuilder.UseDistributedCache() Method

Enables distributed caching for Reporting components in ASP.NET Core applications.

Namespace: DevExpress.AspNetCore.Reporting

Assembly: DevExpress.AspNetCore.Reporting.v23.2.dll

NuGet Package: DevExpress.AspNetCore.Reporting

Declaration

public WebDocumentViewerConfigurationBuilder UseDistributedCache()

Returns

Type Description
WebDocumentViewerConfigurationBuilder

A WebDocumentViewerConfigurationBuilder that can be used to further configure the Web Document Viewer services.

Remarks

The UseDistributedCache method enables the reporting components to use the distributed caching mechanism that is implemented and configured in the application.

The distributed caching mechanism implements a cache that runs as an external service that can be used by multiple application servers. Distributed caching can improve the performance and scalability of an application hosted on multiple servers or in the cloud.

ASP.NET Core allows you to choose from various types of distributed cache implementations (SQL Server, Distributed Redis Cache, Distributed NCache). The ASP.NET Core application should use the IDistributedCache interface to work with any implementation.

The Web Document Viewer component uses a document cache while building the document. The DevExpress Reporting components can work with the IDistributedCache interface, which means that any storages implemented with this interface are automatically available.

To enable our components to use the IDistributedCache implementation, call the UseDistributedCache method at application startup. The distributed cache implementation should be deployed according to Microsoft guidelines.

Note

You must call the UseCachedReportSourceBuilder() method at the application startup if you use distributed cache.

The following code enables the Web Document Viewer to use the ASP.NET Core distributed cache:

var builder = WebApplication.CreateBuilder(args);

builder.Services.ConfigureReportingServices(configurator => {
    configurator.ConfigureWebDocumentViewer(viewerBuilder => viewerBuilder.UseDistributedCache())
});

var app = builder.Build();

Limitations

A distributed cache with the IDistributedCache implementation does not work for the ASP.NET platform.

See Also