mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
fix: #8789,cache meta.settings
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user