Skip to content

Commit edf8e5f

Browse files
Merge pull request #194 from hliang/fix-default-options-ttl
fix(cache-manager): do not mutate ttl of default cache options
2 parents 13c774a + 06a0c0b commit edf8e5f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/cache.providers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Provider } from '@nestjs/common';
22
import { loadPackage } from '@nestjs/common/utils/load-package.util';
33
import { CACHE_MANAGER } from './cache.constants';
44
import { MODULE_OPTIONS_TOKEN } from './cache.module-definition';
5-
import { defaultCacheOptions } from './default-options';
5+
import { defaultCacheOptions as defaultCacheOptionsOrigin } from './default-options';
66
import {
77
CacheManagerOptions,
88
CacheStore,
@@ -17,6 +17,7 @@ export function createCacheManager(): Provider {
1717
return {
1818
provide: CACHE_MANAGER,
1919
useFactory: async (options: CacheManagerOptions) => {
20+
const defaultCacheOptions = { ...defaultCacheOptionsOrigin };
2021
const cacheManager = loadPackage('cache-manager', 'CacheModule', () =>
2122
require('cache-manager'),
2223
);

0 commit comments

Comments
 (0)