Documentation
User & admin guide
Back to Calendar
Admin guide

Cache

What herbe.calendar caches, when to invalidate it, and how to do so from the admin panel.

herbe.calendar maintains a local cache of ERP data and calendar sync state to reduce load on external systems and keep the calendar responsive. Most of the time the cache manages itself. Occasionally you need to invalidate it manually.

What is cached

  • ERP data — activity groups, pipeline structures, person codes, and related reference data fetched from the ERP. Refreshed on every scheduled cron sync.
  • Calendar sync state — incremental sync tokens from Outlook and Google, used to fetch only changes since the last sync rather than re-fetching everything.

How fresh the calendar copy is

Events (ERP, Outlook, Google) are shown from a saved copy. When the last good sync of a source is more than 20 minutes old (the cron runs every 15), the next read answers from the copy at once and starts one refresh in the background, at most once per 10 minutes per account and source. It is skipped while the cron's own sync is running. A refresh that does not bring the source up to date (a partial run, an ERP maintenance window, a provider that fails) is not retried for an hour. On a deployment where Vercel runs no cron (every preview, such as calendar-test), this is what keeps events current: an event deleted at Outlook or Google disappears from the calendar a few minutes later. If a person's own Google sign-in has expired or been revoked (Google answers invalid_grant; this happens every few days when the Google OAuth app is still in testing mode), their Google calendars cannot be refreshed: the sync records "reconnect Google", the calendar list and the AI assistant's list warn that events deleted in Google may still show, and the person reconnects Google in calendar settings. A refresh never removes or overwrites an event saved after it started reading, so an event you just created is safe.

When to invalidate manually

The most common reason: ERP data changed but the change didn't trigger a webhook and the next scheduled sync hasn't run yet.

Invalidate the cache if:

  • An ERP change (new activity group, renamed stage, updated person code) isn't reflected in the calendar after 15+ minutes.
  • You've added a new ERP connection and want to populate data immediately.
  • You're troubleshooting a sync issue and want to rule out stale cache.

How to invalidate

Go to Admin → Cache.

  • Invalidate ERP cache — clears all cached ERP reference data. The next request triggers a fresh fetch from ERP. There may be a brief delay on the next calendar load while the cache rebuilds.
  • Invalidate sync state — clears incremental sync tokens for Outlook or Google. The next sync for that connection runs a full re-fetch rather than a delta. Use this only if you suspect the sync token is corrupted; full re-fetches are slower and put more load on the external API.

Both options take effect immediately.