Gets a reference to the ReportCache object that controls how reports are cached on the server.

Namespace:  C1.Web.UI.Controls.C1Report
Assembly:  C1.Web.UI.Controls.C1Report.2 (in C1.Web.UI.Controls.C1Report.2.dll)

Syntax

C#
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
[C1CategoryAttribute("Behavior")]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
public ReportCache Cache { get; }
Visual Basic
<TypeConverterAttribute(GetType(ExpandableObjectConverter))> _
<C1CategoryAttribute("Behavior")> _
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)> _
<PersistenceModeAttribute(PersistenceMode.InnerProperty)> _
Public ReadOnly Property Cache As ReportCache
	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 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 (Cache property), and can be set up to match your server configuration, including Web Farm scenarios.

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

Examples

The code below configures the 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).
Copy CodeC#
// 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