Caching keeps a reusable result close to an application so later requests need not repeat the same work. In an AI application, a cache layer can hold frequently accessed data or model responses, reducing latency and computational load. Redis and Memcached are possible cache stores. section 1.2.1
In Next.js, choose caching behavior according to how often the result changes:
- For a changing chat response, set `export const dynamic = 'force-dynamic'` in the route handler so requests are reevaluated on the server. The default `auto` setting can cache GET responses. section 2.8.6
- For an individual fetch, use `cache: 'no-store'` for dynamic data or `next: { revalidate: 3600 }` to set a revalidation interval for static data. section 2.8.7
- For a static page that needs occasional updates, incremental static regeneration can serve the old page after its revalidation interval while generating a new one in the background. section 2.8.7
Reuse interview feedback
An interview assistant caches LLM-generated feedback in Redis under `feedback:${sessionId}`. A later visit to the feedback page can reuse that result instead of regenerating it. This is distinct from its Redis session records, which the sidebar retrieves to list past interviews. section 10.1.3
Treat caching as a deployment decision as well as a code setting: assess latency, apply local caching where appropriate, and optimize API calls and data retrieval. Do not cache a frequently changing response merely because a route supports it. section 9.6.2 section 2.8.6





































