incrementalCacheHandlerPath
In Next.js, the default cache handler uses the filesystem cache. This requires no configuration, however, you can customize the cache handler by using the incrementalCacheHandlerPath
field in next.config.js
.
Here's an example of a custom cache handler:
API Reference
The cache handler can implement the following methods: get
, set
, and revalidateTag
.
get()
Parameter | Type | Description |
---|---|---|
key | string | The key to the cached value. |
Returns the cached value or null
if not found.
set()
Parameter | Type | Description |
---|---|---|
key | string | The key to store the data under. |
data | Data or null | The data to be cached. |
Returns Promise<void>
.
revalidateTag()
Parameter | Type | Description |
---|---|---|
tag | string | The cache tag to revalidate. |
Returns Promise<void>
. Learn more about revalidating data or the revalidateTag()
function.