SShortSingh.
Back to feed

Next.js Four-Layer Caching Model Explained: How Each Cache Works and Why It Matters

0
·63 views

Next.js uses four distinct caching mechanisms — request memoization, data cache, full route cache, and router cache — each operating at a different scope and lifetime. Request memoization deduplicates identical fetch calls within a single server render pass and resets once the response is sent. The data cache persists fetch responses across multiple server requests until explicitly revalidated, while the full route cache stores prerendered HTML generated at build time. The router cache retains client-side navigation payloads for 30 seconds on dynamic routes and up to 5 minutes on static ones. Treating these four layers as a single system is the root cause of stale-data bugs and performance issues in many Next.js applications.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingHacker News ·

Possible New Dwarf Planet Spotted Beyond Pluto on a Roughly 280-Year Orbit

Astronomers have identified a mysterious object orbiting the Sun far beyond Pluto, which could be a previously unknown dwarf planet. The body is estimated to take roughly 280 years to complete one orbit. Its classification remains tentative, as it is a candidate rather than a confirmed discovery. Researchers continue to study the object to determine its size, path, and composition. The find adds to ongoing efforts to map the distant outer reaches of the Solar System.

0
ProgrammingHacker News ·

Apify Reports Security Incident, Details Limited in Available Source

Apify, a web scraping and automation platform, has published an incident notice on its public status page regarding a security issue. The only information available is the headline and a link to the status page, so the scope, cause, and affected users cannot be confirmed from this item. The post drew modest attention on Hacker News with 7 points and no comments at the time it was captured. Readers seeking specifics should consult Apify's official incident page directly for updates.

0
ProgrammingHacker News ·

Google Introduces Gemini 4 Hydrogen and Orchestrator in Antigravity

Google has published a blog post announcing Gemini 4 Hydrogen and an Orchestrator within its Antigravity platform. The announcement appeared on Hacker News, where it drew 20 points and 2 comments from readers. The source material provided is limited to the headline, link, and engagement metrics, so the specific capabilities and technical details of the release are not described here. Readers interested in the features are directed to Google's original blog post for full information.

0
ProgrammingDEV Community ·

Silent API failures mislead AI agents into trusting wrong results

A developer found that a popular email API returned HTTP 200 with unfiltered results when asked for bounced emails, which an AI agent could present to users as accurate. A study of 27 live vendor APIs using 219 deliberately wrong requests found that constraints stated only in documentation, rather than enforced in schemas, led to silent failures that agents rarely noticed or corrected. Agents frequently gave users false information, sometimes claiming items did not exist or inventing figures. Other examples include an AI agent community platform where filters were ignored without error and an API that dropped unknown fields without warning. The author also points to a response that violated its own spec when a field-selection option was used and to confusing use of 400 and 401 status codes. The findings suggest that machine-checkable constraints and honest error responses are essential for reliable agent behavior.