diff --git a/docs/content/1.guide/1.introduction/5.cache.md b/docs/content/1.guide/1.introduction/5.cache.md index eb75aa541c..54d9f4b8bb 100644 --- a/docs/content/1.guide/1.introduction/5.cache.md +++ b/docs/content/1.guide/1.introduction/5.cache.md @@ -17,6 +17,7 @@ const cachedFn = cachedEventHandler(fn, options) - `integrity`: A value that changing it, will invalidate all caches for function. By default will be computed from **function code**. - `maxAge`: Maximum age that cache is valid in seconds. Default is `1` second. - `swr`: Enable Stale-While-Revalidate behavior. Enabled by default. +- `base`: Name of the storage mointpoint to use for caching (`/cache` by default) ## Examples @@ -54,3 +55,28 @@ export default defineNitroConfig({ } }) ``` + + +**Example:** Set cache storage mountpoint for a group of routes (**🧪 Experimental!**) + +```js +// nitro.config.ts +import { defineNitroConfig } from 'nitropack' + +export default defineNitroConfig({ + storage: { + 'my-custom-storage': { + driver: 'redis', + url: 'redis://localhost:6379' + } + }, + routeRules: { + '/blog/**': { + swr: true, + cache: { + base: '/my-custom-storage' + } + } + } +}) +```