Files
NodeBB/src/socket.io/admin/cache.js

24 lines
577 B
JavaScript
Raw Normal View History

2020-07-29 12:50:18 -04:00
'use strict';
const SocketCache = module.exports;
SocketCache.clear = async function () {
require('../../posts/cache').reset();
require('../../database').objectCache.reset();
require('../../groups').cache.reset();
require('../../cache').reset();
};
SocketCache.toggle = async function (socket, data) {
const caches = {
post: require('../../posts/cache'),
object: require('../../database').objectCache,
group: require('../../groups').cache,
local: require('../../cache'),
};
if (!caches[data.name]) {
return;
}
caches[data.name].enabled = data.enabled;
};