File tree Expand file tree Collapse file tree 7 files changed +16
-11
lines changed Expand file tree Collapse file tree 7 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 54
54
"@types/lru-cache" : " ^5.1.0" ,
55
55
"ioredis-mock" : " ^4.21.8"
56
56
},
57
- "gitHead" : " 12356d80b38a7b841fa377840f13c37fbe3c9cd3 "
57
+ "gitHead" : " c938eba762060f940a34bc192bec03bc76ea4017 "
58
58
}
Original file line number Diff line number Diff line change 51
51
"devDependencies" : {
52
52
"@types/lru-cache" : " ^5.1.0"
53
53
},
54
- "gitHead" : " 179ca6def52cbf51e09fc22c09f7313d6356105b "
54
+ "gitHead" : " c938eba762060f940a34bc192bec03bc76ea4017 "
55
55
}
Original file line number Diff line number Diff line change 51
51
"@hokify/node-ts-cache" : " ^5.4.0" ,
52
52
"@types/node-cache" : " ^4.2.5"
53
53
},
54
- "gitHead" : " 179ca6def52cbf51e09fc22c09f7313d6356105b "
54
+ "gitHead" : " c938eba762060f940a34bc192bec03bc76ea4017 "
55
55
}
Original file line number Diff line number Diff line change 63
63
"proxyquire" : " 2.1.3" ,
64
64
"sinon" : " 9.2.0"
65
65
},
66
- "gitHead" : " 179ca6def52cbf51e09fc22c09f7313d6356105b "
66
+ "gitHead" : " c938eba762060f940a34bc192bec03bc76ea4017 "
67
67
}
Original file line number Diff line number Diff line change 54
54
"@types/ioredis" : " ^4.17.6" ,
55
55
"ioredis-mock" : " ^4.21.8"
56
56
},
57
- "gitHead" : " 7d2e5b85914c7a6e54edad434b0fcbae37c484b4 "
57
+ "gitHead" : " c938eba762060f940a34bc192bec03bc76ea4017 "
58
58
}
Original file line number Diff line number Diff line change 53
53
"url" : " https://github.com/hokify/node-ts-cache/issues"
54
54
},
55
55
"homepage" : " https://github.com/hokify/node-ts-cache/tree/master/ts-cache#readme" ,
56
- "gitHead" : " 179ca6def52cbf51e09fc22c09f7313d6356105b "
56
+ "gitHead" : " c938eba762060f940a34bc192bec03bc76ea4017 "
57
57
}
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const defaultKeyStrategy = {
7
7
parameter : any ,
8
8
args : any ,
9
9
_phase : 'read' | 'write'
10
- ) : string {
10
+ ) : string | undefined {
11
11
return `${ className } :${ methodName } :${ JSON . stringify (
12
12
parameter
13
13
) } :${ JSON . stringify ( args ) } `;
@@ -136,17 +136,22 @@ export function MultiCache(
136
136
if ( ! process . env . DISABLE_CACHE_DECORATOR ) {
137
137
// save back to all caching strategies
138
138
const saveToCache = originalMethodResult . map ( ( content , i ) => {
139
- return {
140
- key : keyStrategy . getKey (
139
+ const key = keyStrategy . getKey (
141
140
className ,
142
141
methodName ,
143
142
missingKeys [ i ] ,
144
143
args ,
145
144
'write'
146
- ) ,
145
+ ) ;
146
+ if ( key === undefined ) {
147
+ return undefined ;
148
+ }
149
+
150
+ return {
151
+ key,
147
152
content,
148
153
} ;
149
- } ) ;
154
+ } ) . filter ( f => f !== undefined ) as { key : string ; content : any } [ ]
150
155
151
156
// console.log('saveToCache', saveToCache);
152
157
You can’t perform that action at this time.
0 commit comments