Concepts

The model behind Weir, starting from the failures it exists to prevent.

A shared cache sits between clients and an origin and answers some requests itself. Most of the time that makes the origin's life easier. The pages here are about the times it does not: the moments when a cache sends the origin more work, all at once, than it would have had with no cache at all.

Start from the failure

When this happensThe origin seesRead
Entries stored together reach the end of their lifetime togetherthe whole batch again, in the same secondFreshness and staleness
One popular entry expiresevery waiting request for itCoalescing
A purge, a restart or a cold start empties many keysthousands of different requests that share nothingOrigin protection
The origin slows down or failsa queue of requests, each paying the full timeoutOrigin protection
A request header the cache does not key changes the responsenothing unusual; the damage is a poisoned entry served to everyoneThe cache key
You need to remove content nowa stampede, if the purge deletes entries outrightPurging

Then the machinery

Request flow walks one request through the nine stages every Serve call runs. Stores covers where entries live, the memory store's eviction policy, and what changes when several nodes share a Valkey server.

Words these pages use

TermMeaning
OriginThe server Weir fetches from. Anything with a Fetch method.
Shared cacheA cache whose stored responses are reused across users, in the RFC 9111 sense. Weir is never a private cache.
CoalescingSeveral concurrent requests for one key sharing one origin fetch. Other projects call it request collapsing or single-flight.
FlightOne coalesced fetch and the requests waiting on it. The first requester is the leader, the rest are followers.
Soft purge and hard purgeSoft marks entries stale so they can still be served and revalidated. Hard makes them unusable.
Stale-while-revalidate (SWR) and stale-if-error (SIE)The two windows, after an entry expires, in which it may still be served: SWR always, with a refresh in the background, and SIE only when the origin is failing.
PartitionThe unit of fairness in the limiter: scheme, host and path, without the query. A flood of query strings on one path is one partition.

Each concept page ends with a "Limits" section. If a page does not tell you where the feature stops, that is a bug in the page; report it.