You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
390 B
JavaScript

'use strict';
const cacheCreate = require('../cacheCreate');
module.exports = function (Groups) {
Groups.cache = cacheCreate({
name: 'group',
max: 40000,
maxAge: 0,
});
Groups.clearCache = function (uid, groupNames) {
if (!Array.isArray(groupNames)) {
groupNames = [groupNames];
}
const keys = groupNames.map(name => `${uid}:${name}`);
Groups.cache.del(keys);
};
};