ip-list.js
501 Bytes
'use strict';
const cache = global.yoho.cache.master;
const _ = require('lodash');
const logger = global.yoho.logger;
module.exports = (limiter, policy) => {
// 和pc共用
const key = `pc:limiter:${limiter.remoteIp}`;
return cache.getAsync(key).then((result) => {
logger.debug(key, result);
if (result && _.isNumber(result) && result !== -1) {
return Promise.resolve(policy);
} else {
return Promise.resolve(true);
}
});
};