Turn on cacheComponents: true (enabled here), then mark queries with 'use cache' and cacheLife('hours').
const nextConfig: NextConfig = {
cacheComponents: true,
};
export async function getBooksPage(query: BookQuery): Promise<BookSummary[]> {
'use cache';
cacheLife('hours');
// ...query the database
}
From this repo's next-books/next.config.ts (other options omitted) and features/book/book-queries.ts (query body omitted).