MCSManager/helper/TokenManager.js
2020-10-08 11:59:48 +08:00

20 lines
504 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);
};