Do not assume five Server Components necessarily produce five database calls, but make the deduplication boundary explicit. Wrap the shared server read with React `cache()` so repeated calls with the same arguments are deduplicated within one render pass: ```ts import { cache } from 'react' export const getUser = cache(async (id: string) => db.user.findUnique({ where: { id } })) ``` Use the Data Cache only when the data may be shared and cached safely; keep personalized data private or uncach...
Installs into .claude/skills of the current project.
Are you the author of Nextjs Caching?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-nextjs-caching-68c19973)
# Repeated server reads
Do not assume five Server Components necessarily produce five database calls, but make the deduplication boundary explicit. Wrap the shared server read with React `cache()` so repeated calls with the same arguments are deduplicated within one render pass:
```ts
import { cache } from 'react'
export const getUser = cache(async (id: string) => db.user.findUnique({ where: { id } }))
```
Use the Data Cache only when the data may be shared and cached safely; keep personalized data private or uncached. Measure the actual query count in development and production-like conditions.