diff --git a/packages/common/cache/cache.providers.ts b/packages/common/cache/cache.providers.ts index 082c7029ff5..83f664eb957 100644 --- a/packages/common/cache/cache.providers.ts +++ b/packages/common/cache/cache.providers.ts @@ -3,7 +3,7 @@ import { loadPackage } from '../utils/load-package.util'; import { CACHE_MANAGER } from './cache.constants'; import { MODULE_OPTIONS_TOKEN } from './cache.module-definition'; import { defaultCacheOptions } from './default-options'; -import { CacheManagerOptions } from './interfaces/cache-manager.interface'; +import { CacheManagerOptions, CacheStore } from './interfaces/cache-manager.interface'; /** * Creates a CacheManager Provider. @@ -28,11 +28,11 @@ export function createCacheManager(): Provider { ...{ ...options, store }, }); } - let cache: string | Function = 'memory'; + let cache: string | Function | CacheStore = 'memory'; defaultCacheOptions.ttl *= 1000; if (typeof store === 'object' && 'create' in store) { cache = store.create; - } else if (typeof store === 'function') { + } else if (typeof store === 'object' || typeof store === 'function') { cache = store; } return cacheManager.caching(cache, {