Caching Strategies
Cache product data, cart state, and global data.
Updated
On this page
Next.js Built-in Caching
Next.js App Router caches fetch calls by default. The SDK leverages this for server components.
Cache product data, cart state, and global data.
Updated
Next.js App Router caches fetch calls by default. The SDK leverages this for server components.
// Revalidate every 60 seconds
export const revalidate = 60
export default async function Products() {
const { products } = await dash.products.list()
// ...
}
The SDK includes a revalidation handler for webhooks:
// app/api/revalidate/route.ts
import { createRevalidateHandler } from "dash4devs"
export const POST = createRevalidateHandler({
secret: process.env.REVALIDATION_SECRET!,
})
Configure a webhook to call this endpoint when products or content change.
Pass caching=false to bypass server-side cache:
GET /storefront/products?caching=false