File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export { CACHE_MANAGER } from './cache.constants' ;
12export * from './cache.module' ;
23export * from './decorators' ;
34export * from './interceptors' ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export class CacheInterceptor implements NestInterceptor {
3232 context : ExecutionContext ,
3333 call$ : Observable < any > ,
3434 ) : Promise < Observable < any > > {
35- const key = this . getCacheKey ( context ) ;
35+ const key = this . trackBy ( context ) ;
3636 if ( ! key ) {
3737 return call$ ;
3838 }
@@ -47,12 +47,16 @@ export class CacheInterceptor implements NestInterceptor {
4747 }
4848 }
4949
50- getCacheKey ( context : ExecutionContext ) : string | undefined {
50+ trackBy ( context : ExecutionContext ) : string | undefined {
5151 if ( ! this . isHttpApp ) {
5252 return this . reflector . get ( CACHE_KEY_METADATA , context . getHandler ( ) ) ;
5353 }
5454 const request = context . getArgByIndex ( 0 ) ;
55- if ( this . httpServer . getRequestMethod ( request ) !== 'GET' ) {
55+ const excludePaths = [ ] ;
56+ if (
57+ this . httpServer . getRequestMethod ( request ) !== 'GET' ||
58+ excludePaths . includes ( this . httpServer . getRequestUrl )
59+ ) {
5660 return undefined ;
5761 }
5862 return this . httpServer . getRequestUrl ( context . getArgByIndex ( 0 ) ) ;
You can’t perform that action at this time.
0 commit comments