File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -639,9 +639,11 @@ function ApiCache() {
639639 // attempt cache hit
640640 var redis = opt . redisClient
641641 var cached = ! redis ? memCache . getValue ( key ) : null
642+ // skip cache load when x-apicache-revalidate is present
643+ var revalidate = req . headers [ 'x-apicache-revalidate' ]
642644
643645 // send if cache hit from memory-cache
644- if ( cached ) {
646+ if ( ! revalidate && cached ) {
645647 var elapsed = new Date ( ) - req . apicacheTimer
646648 debug ( 'sending cached (memory-cache) version of' , key , logDuration ( elapsed ) )
647649
@@ -650,7 +652,7 @@ function ApiCache() {
650652 }
651653
652654 // send if cache hit from redis
653- if ( redis && redis . connected ) {
655+ if ( ! revalidate && redis && redis . connected ) {
654656 try {
655657 redis . hgetall ( key , function ( err , obj ) {
656658 if ( ! err && obj && obj . response ) {
You can’t perform that action at this time.
0 commit comments