File tree 2 files changed +12
-5
lines changed
integration/cache/src/multi-store 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { CacheModule , Module } from '@nestjs/common' ;
2
- import * as redisStore from 'cache-manager-redis-store' ;
2
+ import { redisStore } from 'cache-manager-redis-store' ;
3
3
import { MultiStoreController } from './multi-store.controller' ;
4
4
5
5
@Module ( {
Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ import { loadPackage } from '../utils/load-package.util';
3
3
import { CACHE_MANAGER } from './cache.constants' ;
4
4
import { MODULE_OPTIONS_TOKEN } from './cache.module-definition' ;
5
5
import { defaultCacheOptions } from './default-options' ;
6
- import { CacheManagerOptions } from './interfaces/cache-manager.interface' ;
6
+ import {
7
+ CacheManagerOptions ,
8
+ CacheStore ,
9
+ } from './interfaces/cache-manager.interface' ;
7
10
8
11
/**
9
12
* Creates a CacheManager Provider.
@@ -28,10 +31,14 @@ export function createCacheManager(): Provider {
28
31
...{ ...options , store } ,
29
32
} ) ;
30
33
}
31
- let cache : string | Function = 'memory' ;
34
+ let cache : string | Function | CacheStore = 'memory' ;
32
35
defaultCacheOptions . ttl *= 1000 ;
33
- if ( typeof store === 'object' && 'create' in store ) {
34
- cache = store . create ;
36
+ if ( typeof store === 'object' ) {
37
+ if ( 'create' in store ) {
38
+ cache = store . create ;
39
+ } else {
40
+ cache = store ;
41
+ }
35
42
} else if ( typeof store === 'function' ) {
36
43
cache = store ;
37
44
}
You can’t perform that action at this time.
0 commit comments