Skip to content

cache ​

Classes ​

TenantCacheInterceptor ​

Defined in: src/cache/tenant-cache.interceptor.ts:21

Extends ​

  • CacheInterceptor

Constructors ​

Constructor ​
ts
new TenantCacheInterceptor(
   cacheManager,
   reflector,
   options?,
   diagnostics?): TenantCacheInterceptor;

Defined in: src/cache/tenant-cache.interceptor.ts:29

Parameters ​
ParameterType
cacheManagerany
reflectorReflector
options?TenantCacheInterceptorOptions
diagnostics?TenantContextDiagnostics
Returns ​

TenantCacheInterceptor

Overrides ​
ts
CacheInterceptor.constructor

Methods ​

intercept() ​
ts
intercept(context, next): Promise<Observable<any>>;

Defined in: node_modules/@nestjs/cache-manager/dist/interceptors/cache.interceptor.d.ts:15

Method to implement a custom interceptor.

Parameters ​
ParameterTypeDescription
contextExecutionContextan ExecutionContext object providing methods to access the route handler and class about to be invoked.
nextCallHandlera reference to the CallHandler, which provides access to an Observable representing the response stream from the route handler.
Returns ​

Promise<Observable<any>>

Inherited from ​
ts
CacheInterceptor.intercept

Interfaces ​

TenantCacheInterceptorOptions ​

Defined in: src/cache/tenant-cache-options.interface.ts:3

Properties ​

diagnostics? ​
ts
optional diagnostics?: TenantContextDiagnostics;

Defined in: src/cache/tenant-cache-options.interface.ts:13

Override the diagnostics service used for missing tenant context.

hashTenantId? ​
ts
optional hashTenantId?: boolean;

Defined in: src/cache/tenant-cache-options.interface.ts:11

Hash tenant IDs before placing them in cache keys.

Default ​
ts
false

resource? ​
ts
optional resource?: string;

Defined in: src/cache/tenant-cache-options.interface.ts:15

Stable cache name included in diagnostics.

separator? ​
ts
optional separator?: string;

Defined in: src/cache/tenant-cache-options.interface.ts:9

Separator used between key parts.

Default ​
ts
':'

sharedPrefix? ​
ts
optional sharedPrefix?: string;

Defined in: src/cache/tenant-cache-options.interface.ts:7

Prefix for intentionally shared cache entries.

Default ​
ts
'shared'

tenantPrefix? ​
ts
optional tenantPrefix?: string;

Defined in: src/cache/tenant-cache-options.interface.ts:5

Prefix for tenant-scoped cache entries.

Default ​
ts
'tenant'

Variables ​

TENANT_CACHE_INTERCEPTOR_OPTIONS ​

ts
const TENANT_CACHE_INTERCEPTOR_OPTIONS: typeof TENANT_CACHE_INTERCEPTOR_OPTIONS;

Defined in: src/cache/tenant-cache.constants.ts:1

Functions ​

SharedTenantCache() ​

ts
function SharedTenantCache(): CustomDecorator<typeof SHARED_TENANT_CACHE_KEY>;

Defined in: src/decorators/shared-tenant-cache.decorator.ts:11

Marks a route or controller as safe to cache without tenant namespacing.

Use only for data that is intentionally identical for every tenant. This affects cache key generation only; it does not bypass tenancy guards or clear tenant context.

Returns ​

CustomDecorator<typeof SHARED_TENANT_CACHE_KEY>

Released under the MIT License.