From 61a4bb9e8d5d5d706cf18a4fc9a36183e19aa462 Mon Sep 17 00:00:00 2001 From: Maxim Ciuchitu <35968905+Leichtwind@users.noreply.github.com> Date: Wed, 23 Nov 2022 17:22:08 +0200 Subject: [PATCH] fix(cache): use passed store object --- packages/common/cache/cache.providers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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, {