Skip to content

Cache warming

By default every report computes live on each request — fine for small stores and short date ranges, painful on large ones. Cache warming flips this around: a scheduled background task pre-computes report payloads, stores them in a cache table, and the report pages serve from cache when a fresh payload exists.

Cache warming runs via the standard Shopware messenger worker, so the same messenger:consume process that handles other Shopware jobs handles this too.

Two layers can be warmed independently:

  • Report cache — payloads for the in-module reports (sales / customers / products / stock / margins).
  • Widget cache — payloads for the order and customer KPI widgets above the list pages.

Each cached payload is keyed by:

  • Report key (e.g. sales.country)
  • Date range
  • Filter values
  • View mode / table type

If a user opens a report with a filter combination that wasn’t warmed, the request computes live and stores the result for next time.

Settings live under Settings → Plugins → P2Lab Stats → Tasks → Cache warming.

SettingWhat it controls
Report cacheEnable / disable warming the in-module reports
Widget cacheEnable / disable warming the KPI widgets
Interval (hours)How often the warmer runs, 1–24 h
Retention (days)How long a cached payload stays valid before being recomputed

Recommended starting point for a mid-volume shop: report cache on, widget cache on, interval 2 h, retention 1 day.

The warmer only pre-computes the default combinations — there’s no way to enumerate every possible filter permutation. Specifically:

  • Every report’s default date preset (configurable per report group)
  • The global default profile for each report
  • Every per-user My default profile that’s been saved

That covers the most common admin landings without exploding cache size. Custom filter combinations still compute live on first request and get cached opportunistically.

Every report has a Refresh button in the right-hand panel. It forces a recompute against the live database for the current filter + range, bypassing the cache. Use it when:

  • You’ve just imported a batch of orders and want the latest numbers
  • A late-arriving cancellation needs to show up immediately
  • You’re debugging unexpected report output

The refresh updates the cache so subsequent loads with the same parameters stay fast.