@@ -35,7 +35,7 @@ const cacheQuery = (req, res, next) => {
3535 console . log ( `Cache HIT: query` )
3636 res . set ( "Content-Type" , "application/json; charset=utf-8" )
3737 res . set ( 'X-Cache' , 'HIT' )
38- res . json ( cachedResult )
38+ res . status ( 200 ) . json ( cachedResult )
3939 return
4040 }
4141
@@ -54,8 +54,8 @@ const cacheQuery = (req, res, next) => {
5454 return originalJson ( data )
5555 }
5656
57- console . log ( "CACHE DETAILS " )
58- console . log ( cache . getDetails ( ) )
57+ console . log ( "CACHE STATS " )
58+ console . log ( cache . getStats ( ) )
5959 next ( )
6060}
6161
@@ -86,7 +86,7 @@ const cacheSearch = (req, res, next) => {
8686 console . log ( `Cache HIT: search "${ searchText } "` )
8787 res . set ( "Content-Type" , "application/json; charset=utf-8" )
8888 res . set ( 'X-Cache' , 'HIT' )
89- res . json ( cachedResult )
89+ res . status ( 200 ) . json ( cachedResult )
9090 return
9191 }
9292
@@ -101,8 +101,8 @@ const cacheSearch = (req, res, next) => {
101101 return originalJson ( data )
102102 }
103103
104- console . log ( "CACHE DETAILS " )
105- console . log ( cache . getDetails ( ) )
104+ console . log ( "CACHE STATS " )
105+ console . log ( cache . getStats ( ) )
106106 next ( )
107107}
108108
@@ -133,7 +133,7 @@ const cacheSearchPhrase = (req, res, next) => {
133133 console . log ( `Cache HIT: search phrase "${ searchText } "` )
134134 res . set ( "Content-Type" , "application/json; charset=utf-8" )
135135 res . set ( 'X-Cache' , 'HIT' )
136- res . json ( cachedResult )
136+ res . status ( 200 ) . json ( cachedResult )
137137 return
138138 }
139139
@@ -148,8 +148,8 @@ const cacheSearchPhrase = (req, res, next) => {
148148 return originalJson ( data )
149149 }
150150
151- console . log ( "CACHE DETAILS " )
152- console . log ( cache . getDetails ( ) )
151+ console . log ( "CACHE STATS " )
152+ console . log ( cache . getStats ( ) )
153153 next ( )
154154}
155155
@@ -176,7 +176,7 @@ const cacheId = (req, res, next) => {
176176 res . set ( 'X-Cache' , 'HIT' )
177177 // Apply same headers as the original controller
178178 res . set ( "Cache-Control" , "max-age=86400, must-revalidate" )
179- res . json ( cachedResult )
179+ res . status ( 200 ) . json ( cachedResult )
180180 return
181181 }
182182
@@ -191,8 +191,8 @@ const cacheId = (req, res, next) => {
191191 return originalJson ( data )
192192 }
193193
194- console . log ( "CACHE DETAILS " )
195- console . log ( cache . getDetails ( ) )
194+ console . log ( "CACHE STATS " )
195+ console . log ( cache . getStats ( ) )
196196 next ( )
197197}
198198
@@ -450,7 +450,7 @@ const invalidateCache = (req, res, next) => {
450450 */
451451const cacheStats = ( req , res ) => {
452452 const stats = cache . getStats ( )
453- const details = req . query . details === 'true' ? cache . getDetails ( ) : undefined
453+ const details = req . query . details === 'true' ? cache . getStats ( ) : undefined
454454
455455 res . json ( {
456456 stats,
0 commit comments