The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/settings/server/raw.js

31 lines
602 B

import Settings from '../../models/server/models/Settings';
const cache = new Map();
export const setValue = (_id, value) => cache.set(_id, value);
const setFromDB = async (_id) => {
const setting = Settings.findOneById(_id, { fields: { value: 1 } });
if (!setting) {
return;
}
setValue(_id, setting.value);
return setting.value;
};
export const getValue = async (_id) => {
if (!cache.has(_id)) {
return setFromDB(_id);
}
return cache.get(_id);
};
export const updateValue = (id, fields) => {
if (typeof fields.value === 'undefined') {
return;
}
setValue(id, fields.value);
};