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
| Class | Description |
|---|---|
| Cache | Empty base class that will be merged with the Cache interface. |
| CacheInterceptor | Interceptor that handles HTTP caching using cache-manager. |
| CacheModule | Module that provides caching functionality for nestelia. |
Functions
| Function | Description |
|---|---|
| CacheKey | Decorator that sets the caching key used to store/retrieve cached items. |
| CacheTTL | Decorator that sets the cache TTL (time-to-live) duration. |
Interfaces
| Interface | Description |
|---|---|
| CacheManagerOptions | Interface defining Cache Manager configuration options. |
| CacheModuleAsyncOptions | Options for dynamically (asynchronously) configuring the Cache module. |
| CacheOptionsFactory | Factory interface for creating cache options. |
Type Aliases
| Type Alias | Description |
|---|---|
| CacheKeyFactory | Factory function type for generating cache keys dynamically. |
| CacheModuleOptions | Options for configuring the Cache module. |
| CacheOptions | Cache options combining cache manager options with store-specific configuration. |
| CacheTTLFactory | Factory function type for generating TTL (time-to-live) values dynamically. |
Variables
| Variable | Description |
|---|---|
| CACHE_KEY_METADATA | Metadata key for cache key configuration. |
| CACHE_MANAGER | Injection token for the CacheManager provider. |
| CACHE_MODULE_OPTIONS | Re-export of MODULE_OPTIONS_TOKEN for convenience. |
| CACHE_TTL_METADATA | Metadata key for cache TTL configuration. |