Merge remote-tracking branch 'DIYgod/master' into dev

This commit is contained in:
Henry
2019-01-30 09:31:03 +00:00
29 changed files with 1390 additions and 779 deletions

View File

@@ -2,6 +2,7 @@
const lru = require('lru-cache');
const common = require('./cache-common');
const md5 = require('../utils/md5');
module.exports = function(options = {}) {
const {
@@ -55,7 +56,7 @@ module.exports = function(options = {}) {
return async function cache(ctx, next) {
const { url, path } = ctx.request;
const resolvedPrefix = typeof prefix === 'function' ? prefix.call(ctx, ctx) : prefix;
const key = resolvedPrefix + common.md5(ignoreQuery ? path : url);
const key = resolvedPrefix + md5(ignoreQuery ? path : url);
const tkey = key + ':type';
const validityCheck = common.validityCheck(routes, exclude, path);