Editorial question87.2K views743 votes0 answers3,746 following
AI-generatedStale cache responses served after timeout with CacheMiddleware
The goal is to guarantee that responses cached by Django’s CacheMiddleware or the @cache_page decorator are not served stale after their configured timeout, even when the underlying cache backend employs lazy expiration (e.g., Redis without active eviction). Because Django delegates expiration handling to the backend, a key may remain stored past its timeout