Files
NodeBB/src/socket.io/admin/cache.js
Barış Soner Uşaklı f1f9b225b0 feat: #8824, cache refactor (#8851)
* feat: #8824, cache refactor

ability to disable caches
ability to download contents of cache
refactor cache modules to remove duplicated code

* fix: remove duplicate hit/miss tracking

check cacheEnabled in getUncachedKeys
2020-11-06 23:13:12 -05:00

24 lines
577 B
JavaScript

'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;
};