mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-14 10:37:45 +01:00
* 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
24 lines
577 B
JavaScript
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;
|
|
};
|