fix: #8789,cache meta.settings

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 7a3183520f
commit 156e1396f2

@ -4,10 +4,15 @@ const db = require('../database');
const plugins = require('../plugins');
const Meta = require('./index');
const pubsub = require('../pubsub');
const cache = require('../cache');
const Settings = module.exports;
Settings.get = async function (hash) {
const cached = cache.get('settings:' + hash);
if (cached) {
return cached;
}
let data = await db.getObject('settings:' + hash) || {};
const sortedLists = await db.getSetMembers('settings:' + hash + ':sorted-lists');
@ -27,6 +32,7 @@ Settings.get = async function (hash) {
}));
({ values: data } = await plugins.fireHook('filter:settings.get', { plugin: hash, values: data }));
cache.set('settings:' + hash, data);
return data;
};
@ -86,6 +92,7 @@ Settings.set = async function (hash, values, quiet) {
pubsub.publish('action:settings.set.' + hash, values);
Meta.reloadRequired = !quiet;
cache.del('settings:' + hash);
};
Settings.setOne = async function (hash, field, value) {

Loading…
Cancel
Save