Skip to content

Commit d7ab432

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 b00b1e0 commit d7ab432

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
@@ -259,6 +259,12 @@ This package can be used as a Cache Components handler (Node.js runtime) for Nex
259259

260260
### Enable Cache Components + cache handler
261261

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

264270
```ts
@@ -282,6 +288,15 @@ const { redisCacheHandler } = require('@trieb.work/nextjs-turbo-redis-cache');
282288
module.exports = redisCacheHandler;
283289
```
284290

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

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

0 commit comments

Comments
 (0)