Recipe

Cache the loyalty ladder for performance

Cache the loyalty ladder and you all but remove it from your load budget. A five-minute shared cache, keyed on the response’s generated timestamp, keeps the ladder fresh while serving nearly every request from cache. Because the response carries no PII, a public shared cache is perfectly safe.

2 min read

~5 minTTL
no PIIPublic cache OK
SWRServe stale-while-revalidate

Pick a TTL

The tier config changes rarely, so a five-minute TTL is a good balance — a stale ladder for a few minutes is harmless, and you cut the origin calls dramatically.

Use the freshness marker

Each response carries a generated UTC timestamp. Use it as the freshness dimension of your cache key so you can tell a fresh value from a stale one and invalidate cleanly.

Stale-while-revalidate

If your cache supports it, serve the stale copy immediately while refreshing in the background. The user never waits on the origin, and the ladder is at most one TTL behind.

Public vs private cache

There is no PII in the response, so a shared/CDN cache is safe. See Caching public-API responses for the general rules.

Frequently asked questions

Is it safe to cache this in a CDN shared by all users?

Yes. The response is public vocabulary with no PII, so a shared cache carries no cross-user leakage risk.

How do I invalidate?

Watch the generated timestamp; when it moves, the config changed and you can refresh. A short TTL means you rarely need manual invalidation.

Funding for UK limited companies

Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.