Skip to content

Commit

Permalink
Merge pull request #194 from hliang/fix-default-options-ttl
Browse files Browse the repository at this point in the history
fix(cache-manager): do not mutate ttl of default cache options
  • Loading branch information
kamilmysliwiec authored Nov 2, 2023
2 parents 13c774a + 06a0c0b commit edf8e5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cache.providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Provider } from '@nestjs/common';
import { loadPackage } from '@nestjs/common/utils/load-package.util';
import { CACHE_MANAGER } from './cache.constants';
import { MODULE_OPTIONS_TOKEN } from './cache.module-definition';
import { defaultCacheOptions } from './default-options';
import { defaultCacheOptions as defaultCacheOptionsOrigin } from './default-options';
import {
CacheManagerOptions,
CacheStore,
Expand All @@ -17,6 +17,7 @@ export function createCacheManager(): Provider {
return {
provide: CACHE_MANAGER,
useFactory: async (options: CacheManagerOptions) => {
const defaultCacheOptions = { ...defaultCacheOptionsOrigin };
const cacheManager = loadPackage('cache-manager', 'CacheModule', () =>
require('cache-manager'),
);
Expand Down

0 comments on commit edf8e5f

Please sign in to comment.