ComponentOne ScatterChart for ASP.NET Web Forms
C1.Web.Wijmo.Controls.45 Assembly / C1.Web.Wijmo.Controls.C1ReportViewer Namespace / C1ReportViewer Class / Cache Property
Example

In This Topic
    Cache Property (C1ReportViewer)
    In This Topic
    Gets a reference to the C1.Web.Wijmo.Controls.C1ReportViewer.ReportService.ReportCache object that controls how reports are cached on the server.
    Syntax
    'Declaration
     
    Public ReadOnly Property Cache As ReportCache
    public ReportCache Cache {get;}
    Remarks

    The report cache is one of the most powerful features in the C1ReportViewer control. By default, every time the control renders a report, it compresses the resulting Html stream and stores it in the System.Web.UI.Page.Cache object. If the same report is requested again, the control simply fetches it back from the cache and sends it directly to the client. This results in fast response times and consumes little memory (because the reports are cached in compressed form).

    The control is smart enough to detect changes to the report definition and keep track of different versions in the cache. It also detects changes to the report definition file and discards old reports from the cache.

    The cache object itself is provided by the ASP.NET framework (System.Web.UI.Page.Cache property), and can be set up to match your server configuration, including Web Farm scenarios.

    The C1.Web.Wijmo.Controls.C1ReportViewer.ReportService.ReportCache object allows you to disable the cache, specify time out values, and add dependencies (to data source files for example).

    Example
    The code below configures the C1.Web.Wijmo.Controls.C1ReportViewer.ReportService.ReportCache to keep rendered reports in the cache for one hour, renewing the time out period every time a report is retrieved from the cache. It also adds a dependency on a SQL server database file, so whenever the underlying data changes, the control know that the report must be rendered again (the report definition file is automatically added as a dependency).
    // enable cache
    _c1wr.Cache.Enabled = true;
                
    // cached reports expire after one hour
    _c1wr.Cache.Expiration = 60;
                
    // renew one-hour limit whenever a report is retrieved from the cache
    _c1wr.Cache.Sliding = true;
    See Also