Skip to content

Commit

Permalink
fix(cache): use passed store object
Browse files Browse the repository at this point in the history
  • Loading branch information
mciuchitu committed Nov 23, 2022
1 parent 220b098 commit 61a4bb9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/common/cache/cache.providers.ts
Expand Up @@ -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.
Expand All @@ -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, {
Expand Down

0 comments on commit 61a4bb9

Please sign in to comment.