mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Moved cache initialization behind the hostSetting
refs https://github.com/TryGhost/Toolbox/issues/515 - By moving the cache initialization behind the hostSettings configuration we can limit the experimental feature to only hosted environments with special capacities - An example configuration to enable Tags caching looks like this: ``` "hostSettings": { "tagsPublicCache": { "enabled": true }, ``` In addition to have the caching backed by a Redis backend or even InMemoryTTL cache the site configuration should include a cache adapter configuration like this: ``` "adapters": { "cache": { "active": "Memory", "tagsPublic": { "adapter": "TTL", "ttl": 60000 // 60 * 1000 minute }, ```
This commit is contained in:
parent
5216220541
commit
9d4ea7b8c9
1 changed files with 6 additions and 1 deletions
|
@ -8,8 +8,13 @@ class TagsPublicServiceWrapper {
|
|||
// Wire up all the dependencies
|
||||
const models = require('../../models');
|
||||
const adapterManager = require('../adapter-manager');
|
||||
const config = require('../../../shared/config');
|
||||
|
||||
let tagsCache;
|
||||
if (config.get('hostSettings:tagsPublicCache:enabled')) {
|
||||
tagsCache = adapterManager.getAdapter('cache:tagsPublic');
|
||||
}
|
||||
|
||||
const tagsCache = adapterManager.getAdapter('cache:tagsPublic');
|
||||
const {TagsPublicRepository} = require('@tryghost/tags-public');
|
||||
|
||||
this.linkRedirectRepository = new TagsPublicRepository({
|
||||
|
|
Loading…
Add table
Reference in a new issue