Skip to content

Commit 83eda4f

Browse files
committed
feat(cache): Add cache option isGlobal
1 parent d8add27 commit 83eda4f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

packages/common/cache/cache.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class CacheModule {
3030
static register(options: CacheModuleOptions = {}): DynamicModule {
3131
return {
3232
module: CacheModule,
33+
global: options.isGlobal,
3334
providers: [{ provide: CACHE_MODULE_OPTIONS, useValue: options }],
3435
};
3536
}
@@ -45,6 +46,7 @@ export class CacheModule {
4546
static registerAsync(options: CacheModuleAsyncOptions): DynamicModule {
4647
return {
4748
module: CacheModule,
49+
global: options.isGlobal,
4850
imports: options.imports,
4951
providers: [
5052
...this.createAsyncProviders(options),

packages/common/cache/interfaces/cache-module.interface.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { ModuleMetadata, Provider, Type } from '../../interfaces';
22
import { CacheManagerOptions } from './cache-manager.interface';
33

44
export interface CacheModuleOptions extends CacheManagerOptions {
5+
/**
6+
* If "true', register `CacheModule` as a global module.
7+
*/
8+
isGlobal?: boolean;
59
[key: string]: any;
610
}
711

@@ -48,4 +52,8 @@ export interface CacheModuleAsyncOptions
4852
*/
4953
inject?: any[];
5054
extraProviders?: Provider[];
55+
/**
56+
* If "true', register `CacheModule` as a global module.
57+
*/
58+
isGlobal?: boolean;
5159
}

0 commit comments

Comments
 (0)