Caching pages for anonymous visitors is straightforward, but serving cached pages to logged-in customers is a far harder problem — every customer has unique data such as their wallet balance, competition entries, prize states, and personalised popups that cannot be baked into a single shared HTML file. Customer Cache solves this challenge with a smart two-phase approach: deliver the pre-built page in milliseconds, then seamlessly update only the dynamic fragments via AJAX within a fraction of a second. The result is a near-instant experience for every authenticated customer on your platform.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Rahat-Pagecode/gitbook-competitions/llms.txt
Use this file to discover all available pages before exploring further.
How Customer Cache Works
Pre-built HTML is served immediately
When an authenticated customer navigates to a page, the platform serves a pre-built HTML snapshot from the cache rather than generating the page from scratch on the server. This eliminates the database queries and template rendering that typically slow down logged-in page loads, bringing response times down from seconds to milliseconds.
Dynamic fragments are injected via AJAX
Immediately after the cached page is delivered, an AJAX request fetches the customer-specific dynamic content — wallet balance, prize states, competition entry counts, and personalised popups. These elements are updated in the page seamlessly, so customers see their accurate, real-time data within a fraction of a second of the page appearing.
Stale files are detected and regenerated in the background
The platform continuously monitors cached files for staleness. When a file is detected as out of date it is regenerated in the background, ensuring customers always receive an up-to-date experience without ever being served an outdated page or having to wait for a full rebuild.
Cache Invalidation
You do not need to manually clear the cache in the course of normal operations. The platform handles cache invalidation automatically in the two most important scenarios:The cache is cleared automatically whenever a competition is updated or when a competition ends. This ensures customers always see accurate competition states without any manual intervention from operators.
Promotion Traffic and Query String Handling
High-traffic promotional moments — such as email campaigns, Facebook ads, or Klaviyo flows — often send customers to pages with tracking parameters appended to the URL. Without special handling, these query strings can bypass the cache entirely and cause every promotional visitor to trigger a full server-side page render at exactly the moment when traffic is highest. Customer Cache handles this gracefully. Authenticated customers who land on a page carrying any of the following parameters are still served the cached version of the page:- UTM parameters — e.g.
utm_source,utm_medium,utm_campaign - Klaviyo parameters — e.g.
_kx - Facebook tracking parameters
This behaviour ensures that traffic surges from email campaigns and paid social campaigns do not bypass the cache, protecting platform performance exactly when demand is greatest.