@azteam/express 1.2.516 → 1.2.517
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,7 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.
|
|
|
12
12
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13
13
|
function floorToMinute(time, minutes) {
|
|
14
14
|
var roundSecond = minutes * 60;
|
|
15
|
-
return time - time %
|
|
15
|
+
return time - time % roundSecond;
|
|
16
16
|
}
|
|
17
17
|
function _default() {
|
|
18
18
|
var mTimeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5;
|
|
@@ -34,7 +34,7 @@ function _default() {
|
|
|
34
34
|
return _context.abrupt("return", res.status(304).send());
|
|
35
35
|
case 4:
|
|
36
36
|
res.setHeader('ETag', etagHash);
|
|
37
|
-
res.setHeader('Cache-Control',
|
|
37
|
+
res.setHeader('Cache-Control', 'public, no-cache');
|
|
38
38
|
case 6:
|
|
39
39
|
return _context.abrupt("return", next());
|
|
40
40
|
case 7:
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ export default function (key, opts = {}) {
|
|
|
11
11
|
return async function (req, res, next) {
|
|
12
12
|
const {redis} = req;
|
|
13
13
|
if (redis) {
|
|
14
|
-
let cacheKey = key;
|
|
14
|
+
let cacheKey = typeof key === 'function' ? key(req) : key;
|
|
15
15
|
|
|
16
16
|
if (options.query) {
|
|
17
17
|
cacheKey = `${cacheKey}:${_.get(req, options.query)}`;
|
|
@@ -2,7 +2,7 @@ import etag from 'etag';
|
|
|
2
2
|
|
|
3
3
|
function floorToMinute(time, minutes) {
|
|
4
4
|
const roundSecond = minutes * 60;
|
|
5
|
-
return time - (time %
|
|
5
|
+
return time - (time % roundSecond);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export default function (mTimeout = 5) {
|
|
@@ -13,7 +13,7 @@ export default function (mTimeout = 5) {
|
|
|
13
13
|
return res.status(304).send();
|
|
14
14
|
}
|
|
15
15
|
res.setHeader('ETag', etagHash);
|
|
16
|
-
res.setHeader('Cache-Control',
|
|
16
|
+
res.setHeader('Cache-Control', 'public, no-cache');
|
|
17
17
|
}
|
|
18
18
|
return next();
|
|
19
19
|
};
|