MCSManager/helper/TokenManager.js
2018-04-21 14:26:22 +08:00

24 lines
523 B
JavaScript

const baseManagerModel = require('../model/baseManagerModel');
let onlyTokenManager = new baseManagerModel.ModelManager();
module.exports.addToken = (key, value) => {
if (onlyTokenManager.len >= 20) {
//TOken 请求最大等待队列长度,超过则统一删除
onlyTokenManager.clear();
}
onlyTokenManager.add(key, value);
}
module.exports.delToken = (key, value) => {
onlyTokenManager.del(key, value);
}
module.exports.getToken = (key) => {
return onlyTokenManager.get(key);
}