Skip to Content
Technical GuideCaching and Revalidation

Caching and Revalidation

Source review: e30dd9b47, 2026-11-02. There is no single “portal cache”. First identify whether the stale value is browser state, a request memo, generated data, a Next page/fetch result or a deployment/CDN artifact.

Cache ownership

LayerOwner / lifetimeRefresh boundary
Search results and open listingReact providers; mounted browser subtreeA successful fetch replaces results; a URL replacement alone is not a fetch
Profile, recents, NLP historyBrowser storage consumersOwner-specific update/clear; backend changes do not push into localStorage
Request memoizationReact cache, e.g. listing route fetchListing, loadStaticTreeDeduplicates within the render/request scope; not a durable content store
Generated location treepublic/<tenant>/locations.jsonExplicit generation; page ISR does not regenerate this file
Location count mapservices/LocationsTree/static.ts, module promiseProcess-lifetime memo; regenerating the file does not invalidate an existing process memo
CMS fetch dataCMS clients; WordPress default revalidate 3600Client fetch policy and invalidation; distinct from the page interval
Next route dataRoute declarations belowTime-based regeneration or revalidatePath
Self-hosted Next cachecache-handler.js; production outside VercelRedis namespace includes generated deployment id; tags can invalidate entries
Browser/CDN HTML and assetsDeployment-specific infrastructureMust stay consistent with the deployed JavaScript; not controlled by a React provider

Route interval register

These are declarations in the current src/app route files, not a promise of freshness at exactly that wall-clock interval. Runtime dependencies and request APIs can change how a route renders.

Route familyDeclared behavior
Homerevalidate = 3600
Locations catch-allrevalidate = 3600, dynamic = 'force-static'
Dashboard city / residential / condos reportsrevalidate = 86400, force-static, dynamic params enabled
Blog index, post, category, tag and paginationrevalidate = 3600
Authors, author detailrevalidate = 86400
CMS page and pages catalogrevalidate = 86400
Buildings / building / condo catalog and detailrevalidate = 86400
Estimate catch-allrevalidate = 86400 declaration; inspect its request/auth path separately
Embedded estimate and demo; widgets; admin revalidation pageExplicit force-dynamic
Search and listing detailRequest-dependent paths, including metadata/header use
Robots, sitemap index, docs sitemapExplicit force-static
Content sitemap, listing sitemap index and chunksrevalidate = 3600

Redis behavior

next.config.js enables the custom handler only when NODE_ENV is production and VERCEL is absent; it also disables Next’s in-memory cache in that branch. The handler selects REDISCLOUD_URL || REDIS_URL and prefixes keys with portal:slug:<deployment-id>:. Missing/unavailable Redis returns a miss on get and skips writes. Do not diagnose this as proof that a particular fallback cache is durable: persistence also depends on the hosting runtime.

Finite positive revalidation periods receive a Redis TTL of that period plus 3600 seconds. Other entries are written without that TTL. Tag invalidation uses stored timestamps compared with the entry’s last modification. Maps and Buffers have explicit serialization, required for page segments and route-handler bodies. The Next expireTime is 90000 seconds, above the largest declared daily interval.

On-demand refresh

Use the handler contract. Validate rendered content after invalidation, not just the success response. Do not put the secret into screenshots or public example URLs.

Failure diagnosis

An upstream timeout can exhaust server retries before reaching a page’s catch branch. The listing page deliberately renders its fallback template and marks transient metadata failures noindex; other routes may throw. “Every failed ISR serves stale” is not a safe universal description of these page implementations. See Failure and Degradation.

The Redis path, provider caches and generated artifacts were read, not exercised against a production cache. Cache invalidation was not invoked during this audit.

Last updated on