mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
c4f364996b
refs https://github.com/TryGhost/Team/issues/1070 - having a dependency on a model in the cache service meant that Ghost had to know about that and pre-initialize the cache during boot, even though that didn't actually do anything except create a cache instance - by making the cache a simple key/value store able to be populated from the cache settings service when a theme is activated it means that Ghost doesn't need to perform any extra initialization when the cache is initialized via `require`
20 lines
368 B
JavaScript
20 lines
368 B
JavaScript
module.exports = class CustomThemeSettingsCache {
|
|
constructor() {
|
|
this.content = new Object();
|
|
}
|
|
|
|
get(key) {
|
|
return this.content[key].value;
|
|
}
|
|
|
|
getAll() {
|
|
return this.content;
|
|
}
|
|
|
|
populate(settings) {
|
|
settings.forEach((setting) => {
|
|
this.content[setting.key] = setting.value;
|
|
});
|
|
}
|
|
};
|