Authored by 周少峰

Merge branch 'feature/qps' of git.yoho.cn:fe/yohobuy-node into feature/qps

... ... @@ -42,6 +42,10 @@ function _cached(fn, ctx, ttl = HALF_MONTH) {
const args = Array.prototype.slice.call(arguments);
const key = pre + JSON.stringify(args || '[]');
if (!_.get(this.ctx.req.app.locals.pc, 'ci.tdk', false)) {
return Promise.resolve();
}
return _cacheGet(key).catch(() => {
return fn.apply(ctx, args).then(result => {
_cacheSave(key, result, ttl);
... ...