@mondart/nestjs-common-module 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ export interface CachingModuleOptions {
7
7
  username?: string;
8
8
  database?: number;
9
9
  password: string;
10
+ keepAlive?: number;
10
11
  tls?: boolean;
11
12
  }
12
13
  export interface CachingModuleFactory {
@@ -28,6 +28,7 @@ let CachingModule = CachingModule_1 = class CachingModule {
28
28
  password: cachingOptions.password,
29
29
  db: cachingOptions.database,
30
30
  ttl: cachingOptions.ttl,
31
+ keepAlive: cachingOptions.keepAlive,
31
32
  tls: cachingOptions.tls
32
33
  ? {
33
34
  host: cachingOptions.host,
@@ -65,6 +66,7 @@ let CachingModule = CachingModule_1 = class CachingModule {
65
66
  password: cachingOptions.password,
66
67
  db: cachingOptions.database,
67
68
  ttl: cachingOptions.ttl,
69
+ keepAlive: cachingOptions.keepAlive,
68
70
  tls: cachingOptions.tls
69
71
  ? {
70
72
  host: cachingOptions.host,
@@ -25,7 +25,10 @@ let CachingService = class CachingService {
25
25
  async get(key) {
26
26
  const result = await this.cacheManager.get(key);
27
27
  if (result) {
28
- return JSON.parse(result);
28
+ const value = typeof result === 'string'
29
+ ? result
30
+ : result?.value;
31
+ return value ? JSON.parse(value) : undefined;
29
32
  }
30
33
  return undefined;
31
34
  }