Using a Report Cache Mode
Our sample projects and report templates can help you learn the basics of working with our products.For very large reports, cache mode keeps memory usage low by holding only part of the rendered document in memory at a time.
Cache lifecycle. Choose a stable cache key, store the report between requests, and restore it before the next viewer or designer action.
Cache lifecycle. Choose a stable cache key, store the report between requests, and restore it before the next viewer or designer action.
var Stimulsoft = require('stimulsoft-reports-js');
var report = new Stimulsoft.Report.StiReport();
report.loadFile("Over-2.000-pages.mrt");
report.reportCacheMode = Stimulsoft.Report.StiReportCacheMode.On;
Stimulsoft.StiOptions.Engine.ReportCache.amountOfQuickAccessPages = 50; // default 50
report.renderAsync(() => {
console.log("Pages: ", report.renderedPages.count);
report.saveDocumentFile("Over-2.000-pages.mdc");
report.dispose();
});Setting reportCacheMode = On streams rendered pages to a cache instead of keeping them all in memory; amountOfQuickAccessPages controls how many stay readily available. Calling dispose() afterwards frees the resources — important for long-running Node.js services.