Cache Settings
Trendz has several built-in optimizations for reducing report generation time. Two of them are configurable: the View Report cache and the Metrics long-term cache.
How Report Generation Works
Section titled “How Report Generation Works”Understanding where time is spent helps clarify when each cache type helps:
1. User opens view → Trendz builds a query plan 2. System loads matching items (devices / assets) ← slow 3. System loads and aggregates field values ← slow 4. View Report is assembled and sent to the UISteps 2 and 3 are the bottlenecks. Both cache types target these steps.
Metrics Long-Term Cache
Section titled “Metrics Long-Term Cache”The long-term cache stores pre-aggregated field values (telemetry, states, or calculated fields) keyed by entity and time interval. When the same data is needed again — whether for the same view or a different one — Trendz returns it from cache instead of querying ThingsBoard.
Enable the Cache
Section titled “Enable the Cache”- Open the view’s Settings.
- Navigate to the Caching section.
- Enable Enable caching.
- Select the Caching Time Unit (see Cache Intervals below).
- Save the view.
Cache Intervals
Section titled “Cache Intervals”| Interval | Behaviour |
|---|---|
| Full Date (day) | One cached value per entity per day. Use this in most cases. |
| Full Hour | One cached value per entity per hour. Needed only when the final report has an hour-level X-axis — for example, a weekly heatmap with hour-of-day as the X dimension. |
Scheduled Cache Refresh
Section titled “Scheduled Cache Refresh”By default, the cache is populated only when a user or API call triggers a report build. For heavy reports opened infrequently (e.g. daily or weekly dashboards), users may wait several minutes on the first load.
Enabling Auto Refresh makes Trendz pre-populate the cache on a schedule so reports are ready when users open them. The scheduled job runs regardless of whether any user is currently logged in.
- Open the view’s Settings → Caching section.
- Enable Auto Refresh.
- Set the refresh Every value and Time Unit (e.g. every 1 day).
- Save the view.
Clear the Cache
Section titled “Clear the Cache”Clear the long-term cache if you have re-imported or corrected historical data in ThingsBoard — stale cached values would otherwise persist until they expire. Clearing is global only — per-entity or per-field clearing is not supported.
- Click the System settings icon in the bottom-left corner.
- Open Settings.
- Press Clear cache in the Caching section.
View Report Cache
Section titled “View Report Cache”The View Report cache stores the fully assembled report result. When a user revisits the same view without changing the query or time range, Trendz returns the cached report immediately — no re-aggregation needed.
This is most useful for dashboards with multiple states that users navigate between repeatedly.
The report is served from cache only when all three conditions hold:
- The query plan has not changed.
- The time range has not changed.
- The cached report has not expired.
Enable View Report Cache
Section titled “Enable View Report Cache”Cached reports expire after 5 minutes. This cache is enabled globally in system settings (cache.report.enabled) and per-view in View Settings → Caching → Cache Report. Both are enabled by default — no action is usually needed unless you want to disable it for a specific view.