Skip to content

Commit b252401

Browse files
committed
docs: add installation and ESM handler example to cache components section
- Add pnpm install command for cache components setup - Include ESM export example alongside existing CommonJS example - Improve onboarding flow for cache components feature
1 parent 493c242 commit b252401

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ This package can be used as a Cache Components handler (Node.js runtime) for Nex
258258

259259
### Enable Cache Components + cache handler
260260

261+
Install the package in your Next.js app:
262+
263+
```bash
264+
pnpm add @trieb.work/nextjs-turbo-redis-cache redis
265+
```
266+
261267
In your Next.js app, enable Cache Components and point `cacheHandlers.default` to a module that exports the handler instance:
262268

263269
```ts
@@ -281,6 +287,15 @@ const { redisCacheHandler } = require('@trieb.work/nextjs-turbo-redis-cache');
281287
module.exports = redisCacheHandler;
282288
```
283289

290+
If you prefer ESM:
291+
292+
```js
293+
// cache-handler.js
294+
import { redisCacheHandler } from '@trieb.work/nextjs-turbo-redis-cache';
295+
296+
export default redisCacheHandler;
297+
```
298+
284299
### Required environment variables
285300

286301
- `REDIS_URL` (recommended): e.g. `redis://localhost:6379`

0 commit comments

Comments
 (0)