Assembly: C1.Web.C1WebReport.2 (in C1.Web.C1WebReport.2.dll)
Syntax
C# |
---|
[TypeConverterAttribute(typeof(ExpandableObjectConverter))] [PersistenceModeAttribute(PersistenceMode.InnerProperty)] [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)] public ReportCache Cache { get; } |
Visual Basic (Declaration) |
---|
<TypeConverterAttribute(GetType(ExpandableObjectConverter))> _ <PersistenceModeAttribute(PersistenceMode.InnerProperty)> _ <DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)> _ Public ReadOnly Property Cache As ReportCache Get |
Remarks
The report cache is one of the most powerful features in the C1WebReport 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 following code 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).
' 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' add dependency on SQL server data file _c1wr.Cache.FileDependency = "c:\MSSQL7\Data\pubs.mdf" |
// 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; // add dependency on SQL server data file _c1wr.Cache.FileDependency = @"c:\MSSQL7\Data\pubs.mdf"; |