Skip to content
Stand with Ukraine flag

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.

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 UI

Steps 2 and 3 are the bottlenecks. Both cache types target these steps.

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.

  1. Open the view’s Settings.
  2. Navigate to the Caching section.
  3. Enable Enable caching.
  4. Select the Caching Time Unit (see Cache Intervals below).
  5. Save the view.
IntervalBehaviour
Full Date (day)One cached value per entity per day. Use this in most cases.
Full HourOne 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.

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.

  1. Open the view’s Settings → Caching section.
  2. Enable Auto Refresh.
  3. Set the refresh Every value and Time Unit (e.g. every 1 day).
  4. Save the view.

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.

  1. Click the System settings icon in the bottom-left corner.
  2. Open Settings.
  3. Press Clear cache in the Caching section.

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.

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.