1 | import { Provider, Type } from '../../interfaces';
|
2 | import { ConfigurableModuleAsyncOptions } from '../../module-utils';
|
3 | import { CacheManagerOptions } from './cache-manager.interface';
|
4 | export declare type CacheModuleOptions<StoreConfig extends Record<any, any> = Record<string, any>> = CacheManagerOptions & StoreConfig & {
|
5 | /**
|
6 | * If "true', register `CacheModule` as a global module.
|
7 | */
|
8 | isGlobal?: boolean;
|
9 | };
|
10 | /**
|
11 | * Interface describing a `CacheOptionsFactory`. Providers supplying configuration
|
12 | * options for the Cache module must implement this interface.
|
13 | *
|
14 | * @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
|
15 | *
|
16 | * @publicApi
|
17 | */
|
18 | export interface CacheOptionsFactory<StoreConfig extends Record<any, any> = Record<string, any>> {
|
19 | createCacheOptions(): Promise<CacheModuleOptions<StoreConfig>> | CacheModuleOptions<StoreConfig>;
|
20 | }
|
21 | /**
|
22 | * Options for dynamically configuring the Cache module.
|
23 | *
|
24 | * @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
|
25 | *
|
26 | * @publicApi
|
27 | */
|
28 | export interface CacheModuleAsyncOptions<StoreConfig extends Record<any, any> = Record<string, any>> extends ConfigurableModuleAsyncOptions<CacheModuleOptions<StoreConfig>, keyof CacheOptionsFactory> {
|
29 | /**
|
30 | * Injection token resolving to an existing provider. The provider must implement
|
31 | * the `CacheOptionsFactory` interface.
|
32 | */
|
33 | useExisting?: Type<CacheOptionsFactory<StoreConfig>>;
|
34 | /**
|
35 | * Injection token resolving to a class that will be instantiated as a provider.
|
36 | * The class must implement the `CacheOptionsFactory` interface.
|
37 | */
|
38 | useClass?: Type<CacheOptionsFactory<StoreConfig>>;
|
39 | /**
|
40 | * Function returning options (or a Promise resolving to options) to configure the
|
41 | * cache module.
|
42 | */
|
43 | useFactory?: (...args: any[]) => Promise<CacheModuleOptions<StoreConfig>> | CacheModuleOptions<StoreConfig>;
|
44 | /**
|
45 | * Dependencies that a Factory may inject.
|
46 | */
|
47 | inject?: any[];
|
48 | /**
|
49 | * Extra providers to be registered within a scope of this module.
|
50 | */
|
51 | extraProviders?: Provider[];
|
52 | /**
|
53 | * If "true', register `CacheModule` as a global module.
|
54 | */
|
55 | isGlobal?: boolean;
|
56 | }
|