0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Fixed Redis cluster ttl configuration

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

- The cluster config is taking over local adapter ttl configuration - the priority should be reverse adapter config first followed by cluster config
- In addition if we add nested config merging to adapter manager we could achieve the same effect by having per-adapter configuraiton with "clusterConfig.options.ttl" value
This commit is contained in:
Naz 2023-02-14 21:38:08 +08:00
parent f9eeec10db
commit d62eba6c7f
No known key found for this signature in database

View file

@ -22,6 +22,17 @@ class Redis extends BaseCacheAdapter {
this.cache = config.cache;
if (!this.cache) {
// @NOTE: this condition can be avoided if we add merging of nested options
// to adapter configuration. Than adding adapter-specific {clusterConfig: {options: {ttl: XXX}}}
// will be enough to set ttl for redis cluster.
if (config.ttl && config.clusterConfig) {
if (!config.clusterConfig.options) {
config.clusterConfig.options = {};
}
config.clusterConfig.options.ttl = config.ttl;
}
this.cache = cacheManager.caching({
store: redisStore,
ttl: config.ttl,