Moved settings cache to an explicit "in memory" adapter

refs https://github.com/TryGhost/Toolbox/issues/364

- Before introducing an image size caching mechanism we need to make existing caches explicit - makes sure caches are operating in multiple different instances.
- Explicit syntax also allows to pass in different configurations for each cache instance (e.g. use different Redis connections for caches with different purposes)
This commit is contained in:
Naz 2022-08-15 15:17:20 +02:00
parent 05eb719d0a
commit 34b4421452
3 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,7 @@
const Memory = require('./Memory');
class SettingsCacheSyncInMemory extends Memory {
}
module.exports = SettingsCacheSyncInMemory;

View File

@ -67,7 +67,7 @@ module.exports = {
* Initialize the cache, used in boot and in testing
*/
async init() {
const cacheStore = adapterManager.getAdapter('cache');
const cacheStore = adapterManager.getAdapter('cache:settings');
const settingsCollection = await models.Settings.populateDefaults();
SettingsCache.init(events, settingsCollection, this.getCalculatedFields(), cacheStore);
},

View File

@ -25,7 +25,9 @@
"active": "Default"
},
"cache": {
"active": "Memory"
"active": "Memory",
"settings": "SettingsCacheSyncInMemory",
"SettingsCacheSyncInMemory": {}
}
},
"storage": {