nest-profiler-cache
Types and API of the cache collector.
CacheOperationEntry
One entry per cache operation (get, set, del) executed during a request.
Prop
Type
CacheOperation
type CacheOperation = 'GET_HIT' | 'GET_MISS' | 'SET' | 'DEL';GET_HIT- cacheget()returned a valueGET_MISS- cacheget()returnedundefinedornullSET- cacheset()was calledDEL- cachedel()was called
Public exports
import { CacheCollectorModule } from '@eleven-labs/nest-profiler-cache';
import { CacheCollector } from '@eleven-labs/nest-profiler-cache';
import type {
CacheCollectorModuleOptions,
CacheOperationEntry,
CacheOperation,
} from '@eleven-labs/nest-profiler-cache';Setup
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).
CacheCollectorModule.forRoot() takes no configuration options. The collector patches the CACHE_MANAGER's get, set, and del methods with a proxy at module initialization.
There is no forRootAsync by design: the collector has no runtime-resolved options (its only knob, enabled, is a synchronous build-time decision). It lives in the dev-only bundle, or is gated with ConditionalModule.registerWhen(...) under the runtime gate.
Prerequisite: CacheModule.register({ isGlobal: true }) from @nestjs/cache-manager must be registered in the application (provides CACHE_MANAGER globally, so the collector can inject it from the bundle).