nest-profiler-cache
Record cache GET/SET/DEL operations and the hit ratio in the Cache panel.
@eleven-labs/nest-profiler-cache
@eleven-labs/nest-profiler-cache intercepts @nestjs/cache-manager operations (GET HIT, GET MISS, SET, DEL) during a profiled execution and displays them in a Cache panel with hit/miss statistics.

Installation
pnpm add -D @eleven-labs/nest-profiler-cachePeer dependencies: @nestjs/cache-manager ^3.0.0 || ^12.0.0 — your app's own dependency, installed with a plain pnpm add @nestjs/cache-manager.
Setup
Register CacheModule with isGlobal: true in your application module, so the collector can inject the CACHE_MANAGER:
import { Module } from '@nestjs/common';
import { CacheModule } from '@nestjs/cache-manager';
@Module({
imports: [CacheModule.register({ isGlobal: true })],
})
export class AppModule {}Then register the collector in the dev-only profiling bundle:
import { Module } from '@nestjs/common';
import { ProfilerModule } from '@eleven-labs/nest-profiler';
import { CacheCollectorModule } from '@eleven-labs/nest-profiler-cache';
@Module({
imports: [ProfilerModule.forRoot({ isGlobal: true }), CacheCollectorModule.forRoot()],
})
export class ProfilingModule {}
ProfilingModuleis the dev-only bundle loaded bymain-dev.ts— see Enabling and disabling the profiler. If the profiler is installed as a production dependency behind the runtime gate, wrap the same call inConditionalModule.registerWhen(..., isProfilerEnabled).
What it collects
For each cache operation:
| Field | Description |
|---|---|
operation | GET_HIT, GET_MISS, SET, or DEL |
key | Cache key |
duration | Operation duration in ms |
startedAt | Unix timestamp |
The panel also displays an aggregated hit/miss ratio.
Toolbar badge
{hits}H/{misses}M (e.g., 8H/2M). When no GET operations: {n}ops.
How it works
At module initialization, the collector wraps the CACHE_MANAGER's get, set, and del methods using a JavaScript Proxy. Each wrapped call records the operation type, key, and duration into the current request profile.