Cache invalidation is the hard part: give every cached value an expiry and a version
A cache with no expiry serves stale data forever, and a cache you cannot invalidate on demand is a liability during an incident. Expiry and versioning turn both problems into routine operations.
Try this:
1. Set a time-to-live on everything you cache, short enough that stale data is a minor delay rather than a wrong answer.
2. Version cache keys when the shape of the data changes, so a new deploy reads fresh values instead of fighting old ones.
3. Keep a way to purge a single key or prefix on demand, for the day a bad value gets cached and every user sees it.
Example: after a pricing change, customers saw yesterday's prices for hours because the cache key had no version and no expiry.
Source: https://aws.amazon.com/caching/best-practices/
Work like this sits inside the TPBOK practice areas (https://iictp.org/standards/tpbok). IICTP's ATP (https://iictp.org/certifications/atp) and CTP (https://iictp.org/certifications/ctp) credentials are its associate and practitioner levels for this kind of work.
Question for practitioners: Which cached value in your system has no expiry, and what would happen if it went stale tomorrow?