Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install cache-viewer
```

`express` is an optional peer dependency, required only if you use the `cache-viewer/express`
subpath.
subpath. `@nestjs/common` is likewise optional, required only for `cache-viewer/nestjs`.

## Integration

Expand Down Expand Up @@ -85,6 +85,29 @@ app.use("/cache-ui", cacheViewer({ adapter: fromRedis(redis) }));
Key enumeration uses `SCAN` (never `KEYS`), so it's safe against a production-sized Redis
instance.

### NestJS

Requires the Express platform (`@nestjs/platform-express`, Nest's default) — it wraps the
`cache-viewer/express` middleware and registers it via `configure()`, so it's mounted as part
of the module graph instead of touching `main.ts`.

```ts
import { Module } from "@nestjs/common";
import { caching } from "cache-manager";
import { fromCacheManager } from "cache-viewer";
import { CacheViewerModule } from "cache-viewer/nestjs";

const cache = await caching("memory", { max: 1000, ttl: 60_000 });

@Module({
imports: [CacheViewerModule.forRoot("/cache-ui", { adapter: fromCacheManager(cache) })],
})
export class AppModule {}
```

`CacheViewerOptions` (`adapter`, `enabled`, `auth`) are the same as the Express binding — see
[Auth](#auth) below.

## Auth

```ts
Expand Down Expand Up @@ -196,7 +219,7 @@ confirmation.

- RESP protocol shim (connecting RedisInsight directly)
- WebSocket live updates (2s polling is used instead)
- NestJS binding
- Fastify-backed NestJS apps (the NestJS binding wraps the Express middleware)
- Editing/setting values — this is a viewer, not an editor

## License
Expand Down
Loading
Loading