Client Component (Not Cached)

Loading...

Go to Test Page >

Server Components (Not Cached)

Loading...

Server Components (Cached)

Cached Server Time - Cache Tag: 'time'

'use cache' OUTside of the component

Time: 12/2/2025, 6:15:27 PM

Cached Server Time - Cache Tag: 'time'

'use cache' INSide of the component

Time: 12/2/2025, 6:15:27 PM

Cached Server Action

'use cache' OUTside Revalidate every 10 seconds.

Name: John Doe

Email: john@example.com

Fetch Date: 12/2/2025, 6:15:28 PM

Tagged with: 'server-action-user-1'

Cached Server Action

'use cache' INSide Revalidate every 10 seconds.

Name: John Doe

Email: john@example.com

Fetch Date: 12/2/2025, 6:15:28 PM

Tagged with: 'server-action-user-2'

Cached Server Action

No Component-level caching applied. Applied 'use cache' in the 'fetchUser' OUTside of the function.

Name: Cached SA John Doe

Email: sa-john@example.com

Fetch Date: 12/2/2025, 6:15:28 PM

Cached Server Action

No Component-level caching applied. Applied 'use cache' in the 'fetchUser' INSIDE the function.

Name: Cached SA John Doe

Email: sa-john@example.com

Fetch Date: 12/2/2025, 6:15:28 PM

Donut Pattern

Server component (outer donut) wraps a client component (inner hole). The server layer is cached, but the client component remains interactive.

Donut Pattern Example

Server component (cached) wrapping a client component (not cached). The outer layer fetches data, inner layer is interactive.

{"id":1,"name":"John Doe","email":"john@example.com"}

Client component below is NOT cached:

Loading...

Tagged with: 'posts'

Cache Revalidation

Use revalidateTag to invalidate specific cached components. Click a button and refresh to see updated content.

Cache Revalidation

Click buttons to revalidate cached components using revalidateTag