Skip to content

packages/cache/src

Elysia-Nest Cache Manager Module

A comprehensive caching module for Elysia-Nest applications, providing:

  • In-memory and Redis caching support
  • HTTP request/response caching via interceptor
  • Decorators for fine-grained cache control
  • Multi-tier caching with non-blocking operations

Example

Quick start:

typescript
import { CacheModule } from '@nestelia/cache-manager';

@Module({
  imports: [CacheModule.register()],
})
export class AppModule {}

Classes

ClassDescription
CacheEmpty base class that will be merged with the Cache interface.
CacheInterceptorInterceptor that handles HTTP caching using cache-manager.
CacheModuleModule that provides caching functionality for nestelia.

Functions

FunctionDescription
CacheKeyDecorator that sets the caching key used to store/retrieve cached items.
CacheTTLDecorator that sets the cache TTL (time-to-live) duration.

Interfaces

InterfaceDescription
CacheManagerOptionsInterface defining Cache Manager configuration options.
CacheModuleAsyncOptionsOptions for dynamically (asynchronously) configuring the Cache module.
CacheOptionsFactoryFactory interface for creating cache options.

Type Aliases

Type AliasDescription
CacheKeyFactoryFactory function type for generating cache keys dynamically.
CacheModuleOptionsOptions for configuring the Cache module.
CacheOptionsCache options combining cache manager options with store-specific configuration.
CacheTTLFactoryFactory function type for generating TTL (time-to-live) values dynamically.

Variables

VariableDescription
CACHE_KEY_METADATAMetadata key for cache key configuration.
CACHE_MANAGERInjection token for the CacheManager provider.
CACHE_MODULE_OPTIONSRe-export of MODULE_OPTIONS_TOKEN for convenience.
CACHE_TTL_METADATAMetadata key for cache TTL configuration.

Released under the MIT License.