>-Ifthein-memorycacheisn't sufficient for runtime data, [`'usecache:remote'`](/docs/app/api-reference/directives/use-cache-remote) allows platforms to provide a dedicated cache handler, though it may come with its own costs.
>-Ifthein-memorycacheisn't sufficient for runtime data, [`'usecache:remote'`](/docs/app/api-reference/directives/use-cache-remote) allows platforms to provide a dedicated cache handler, though it requires a network roundtrip to check the cache and typically incurs platform fees.
> - For compliance requirements where data must never be cached on the server, or when a deeply nested component needs to access runtime APIs and restructuring would be disruptive, see [`'usecache:private'`](/docs/app/api-reference/directives/use-cache-private).
> - For compliance requirements or when you can'trefactortopassruntimedataasargumentstoa`use cache`scope,see[`'use cache: private'`](/docs/app/api-reference/directives/use-cache-private).
## Usage
## Usage
...
@@ -199,12 +199,12 @@ Runtime cache behavior depends on your hosting environment:
...
@@ -199,12 +199,12 @@ Runtime cache behavior depends on your hosting environment:
| **Serverless** | Cache entries may not persist across requests (each request can be a different instance). Build-time caching works normally. |
|**Serverless**|Cacheentriestypicallydon't persist across requests (each request can be a different instance). Build-time caching works normally. |
| **Self-hosted** | Cache entries persist across requests. Control cache size with [`cacheMaxMemorySize`](/docs/app/api-reference/config/next-config-js/incrementalCacheHandlerPath). |
| **Self-hosted** | Cache entries persist across requests. Control cache size with [`cacheMaxMemorySize`](/docs/app/api-reference/config/next-config-js/incrementalCacheHandlerPath). |
If the default in-memory cache isn'tenough,consider**[`use cache: remote`](/docs/app/api-reference/directives/use-cache-remote)**whichallowsplatformstoprovideadedicatedcachehandler(likeRedisorKVdatabase).Thishelpsreducehitsagainstdatasourcesnotscaledtoyourtotaltraffic,thoughitcomeswithcosts(storage,networklatency,platformfees).
If the default in-memory cache isn'tenough,consider**[`use cache: remote`](/docs/app/api-reference/directives/use-cache-remote)**whichallowsplatformstoprovideadedicatedcachehandler(likeRedisorKVdatabase).Thishelpsreducehitsagainstdatasourcesnotscaledtoyourtotaltraffic,thoughitcomeswithcosts(storage,networklatency,platformfees).
Very rarely, for compliance requirements where certain data must never be cached on the server (even ephemerally), or when a component within a `usecache` scope needs to access runtime APIs like `cookies()` and restructuring the component tree is impractical, you might need **[`usecache:private`](/docs/app/api-reference/directives/use-cache-private)**.
Veryrarely,forcompliancerequirementsorwhenyoucan't refactor your code to pass runtime data as arguments to a `use cache` scope, you might need [`use cache: private`](/docs/app/api-reference/directives/use-cache-private).