Interface: CacheModuleAsyncOptions<T>
Defined in: packages/cache/src/interfaces/cache-module.interface.ts:72
Options for dynamically (asynchronously) configuring the Cache module.
This interface provides multiple ways to configure the cache module:
- useFactory: Use a factory function
- useClass: Use a class implementing CacheOptionsFactory
- useExisting: Use an existing provider
Extends
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
T extends StoreConfigRecord | StoreConfigRecord | Store-specific configuration type. |
Properties
| Property | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|
extraProviders? | Provider[] | Extra providers to be registered within the scope of this module. Useful for providing dependencies required by the factory function. Example extraProviders: [RedisService] | - | - | packages/cache/src/interfaces/cache-module.interface.ts:140 |
imports? | ( | Type<unknown> | DynamicModule)[] | - | - | ModuleMetadata.imports | packages/core/src/interfaces/index.ts:9 |
inject? | ( | ProviderToken | { optional?: boolean; token: ProviderToken; })[] | Dependencies that the factory may inject. Example inject: [ConfigService, RedisService] | ConfigurableModuleAsyncOptions.inject | - | packages/cache/src/interfaces/cache-module.interface.ts:128 |
isGlobal? | boolean | If true, register CacheModule as a global module. Default false | - | - | packages/cache/src/interfaces/cache-module.interface.ts:147 |
provideInjectionTokensFrom? | Provider[] | List of parent module's providers that will be filtered to only provide necessary providers for the 'inject' array useful to pass options to nested async modules | - | ConfigurableModuleAsyncOptions.provideInjectionTokensFrom | packages/core/src/module-utils/interfaces/configurable-module-async-options.interface.ts:60 |
useClass? | Type<CacheOptionsFactory<T>> | Injection token resolving to a class that will be instantiated as a provider. The class must implement the CacheOptionsFactory interface. Example useClass: CacheConfigService | ConfigurableModuleAsyncOptions.useClass | - | packages/cache/src/interfaces/cache-module.interface.ts:98 |
useExisting? | Type<CacheOptionsFactory<T>> | Injection token resolving to an existing provider. The provider must implement the CacheOptionsFactory interface. Example useExisting: ConfigService | ConfigurableModuleAsyncOptions.useExisting | - | packages/cache/src/interfaces/cache-module.interface.ts:87 |
useFactory? | (...args) => | CacheOptions<T> | Promise<CacheOptions<T>> | Function returning options (or a Promise resolving to options) to configure the cache module. Example useFactory: (configService: ConfigService) => ({ ttl: configService.get('CACHE_TTL'), store: redisStore, }), inject: [ConfigService], | ConfigurableModuleAsyncOptions.useFactory | - | packages/cache/src/interfaces/cache-module.interface.ts:116 |