Multiple cache layers with inconsistent keys and TTLs caused different channels to serve different inventory values after an update. During a promotion, customers placed orders for products a warehouse had already marked unavailable.
What happened
Meridian Outfitters introduced caching at three layers—API gateway, application, and marketplace integration—to handle its high-volume commerce platform. The API documented a 60-second cache lifetime. The business expected that confirmed inventory adjustments would be visible shortly afterward.
During a major promotional event, a warehouse discovered damaged products and immediately marked them unavailable. The database updated instantly.
But some channels continued serving the old inventory values. The gateway cache used URL-only keys and didn’t vary by sales channel or fulfillment region. The marketplace integration had its own cache with a longer TTL than documented. Different channels gave different answers for the same SKU: the website showed limited availability, the marketplace showed dozens of units, and store associates saw a third number.
Customers placed orders for products that no longer existed. Customer service had to explain cancellations, and warehouse staff investigated discrepancies that weren’t actually in the source system.
Root cause
The API’s correctness was tested against the database. Nobody tested what consumers actually received through the full caching path after an inventory update. Cache keys didn’t include all response-varying dimensions. No invalidation test existed. No freshness metadata was exposed to help consumers distinguish current from cached data.
The fix
Caching was disabled on the most time-sensitive inventory responses while the team redesigned cache keys, connected inventory events to targeted invalidation, and added cache-control headers with accurate freshness metadata. Consumer caches were brought into alignment with the documented TTL.
Lesson learned
A correct database response doesn’t guarantee a correct API response. Caching is part of the API contract and must be tested—including what consumers receive after the underlying data changes.