From 878e96800992534d565a3919d3b82d0b6b465665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Fri, 9 Dec 2016 16:02:46 +0000 Subject: [PATCH] Support min-fresh request header --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 54e9099..b0b9bbd 100644 --- a/index.js +++ b/index.js @@ -137,6 +137,10 @@ module.exports = class CachePolicy { return false; } + if (requestCC['min-fresh'] && this.timeToLive() < 1000*requestCC['min-fresh']) { + return false; + } + // The presented effective request URI and that of the stored response match, and return (!this._url || this._url === req.url) && (this._host === req.headers.host) &&