Serving Fresh Prices at Scale: Caching Strategies for Deal Sites
Serving Fresh Prices at Scale: Caching Strategies for Deal Sites A deal site lives or dies on one contradiction: prices change constantly, but readers expect every page to load instantly. Crawl a retailer's page on eve
Serving Fresh Prices at Scale: Caching Strategies for Deal Sites
A deal site lives or dies on one contradiction: prices change constantly, but readers expect every page to load instantly. Crawl a retailer's page on every visit and your pages will be slow, your IP will get blocked, and your hosting bill will explode. Cache too aggressively and you will show a $49.99 price that expired yesterday — which is worse than being slow, because it breaks trust.
At Savlume, we treat caching as a correctness problem, not just a performance problem. Here is how we think about it.
Not all prices are equally volatile
The first mistake is giving every price the same cache lifetime. A kitchen appliance that has sat at $99.99 for three weeks does not need to be rechecked every five minutes. A flash deal with a coupon code that expires at midnight does.
We put prices into freshness tiers:
- Stable prices — unchanged across several crawls. Re-check every 6–12 hours.
- Moving prices — changed in the last few crawls. Re-check every 30–60 minutes.
- Expiring deals — a coupon code, a lightning deal, or a stated end date. Re-check every 5–15 minutes until the deal ends, then mark it expired immediately.
The tier is recomputed after every crawl, so a stable product that suddenly drops gets promoted to the moving tier automatically. The cache lifetime follows the data, not a fixed schedule.
Cache the page, not just the price
A guide page is more than a list of prices. It has an introduction, a comparison table, buying advice, and a Q&A section. Most of that content barely changes. Only the price blocks move.
So we cache at two levels:
- The page shell — the static content, cached for hours and served from a CDN edge node close to the reader.
- The price fragments — small, separately cached blocks that are fetched and stitched into the page at render time, each with its own short lifetime.
If a price fetch fails, the page still renders — with the last known price and a visible "last checked" timestamp, rather than a blank hole or an error page. A stale price labelled as stale is honest. A missing price is a broken page.
Stale-while-revalidate: the workhorse pattern
The pattern that does most of the heavy lifting is stale-while-revalidate. When a reader opens a guide:
- Serve the cached price immediately — the page is fast.
- In the background, trigger a re-check if the cached price is older than its tier allows.
- The next reader gets the fresh value.
The reader who triggers the refresh never waits for it. The trade-off is that one reader in a while sees a price that is minutes old, which is why every price on Savlume carries a "last checked" time. Freshness is a fact we show, not a promise we imply.
Invalidate on events, not only on timers
Timers are a blunt tool. Some price changes are predictable events, and we invalidate the cache when they happen:
- A crawl detects a price change → the affected guide's price fragment is invalidated at once, not at the next timer tick.
- A coupon code passes its expiry → the deal is marked expired and the page is rebuilt.
- A product goes out of stock → the listing is flagged, not silently left at the old price.
Event-driven invalidation plus tiered timers means the cache is usually right, and when it is wrong it is wrong for minutes, not hours.
Protect the retailer, protect yourself
Every re-check is a request to someone else's server. A deal site that hammers retailer pages is not just rude — it gets rate-limited or blocked, and then every price goes stale at once.
Three rules keep the crawl polite:
- Respect robots.txt and crawl-delay. If a retailer says slow down, slow down.
- Never re-crawl what has not changed. A HEAD request or a conditional GET with ETag / Last-Modified costs almost nothing and tells you whether a full fetch is needed.
- Deduplicate requests. If ten readers open the same guide in the same minute, that is one re-check, not ten. A single-flight lock collapses duplicate refresh triggers into one crawl.
What "fresh" actually means
There is no such thing as a perfectly fresh price on a deal site. Retailers change prices without notice, and any price you display was true at the moment it was observed — never at the moment it is read. The honest goal is not zero latency. It is a short, known, and disclosed delay.
That is why Savlume marks every price as either retailer-verified or source-reported, and stamps it with the time it was last checked. Caching decides how fast the page loads. The timestamp decides whether the reader can trust what they see.
You can read the guides built on this system at Savlume — and follow Savlume Deals on WhatsApp for the price drops that are actually live: https://whatsapp.com/channel/0029VbE9P7J7DAX7rD8TAC2U
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.