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

Hooked up event aware cache wrapper to posts cache

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

- When caching responses the posts cache can create a situation where it becomes stale within the TTL period and would give stale responses to shared caches.
- Having full cache reset on 'site.changed' event makes cached content evergreen reducing the risk of caching stale content in shared caches
This commit is contained in:
Naz 2023-02-22 22:25:08 +08:00
parent f74b19ab61
commit f049e89a20
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View file

@ -9,6 +9,8 @@ class PostsPublicServiceWrapper {
const {Post} = require('../../models'); const {Post} = require('../../models');
const adapterManager = require('../adapter-manager'); const adapterManager = require('../adapter-manager');
const config = require('../../../shared/config'); const config = require('../../../shared/config');
const EventAwareCacheWrapper = require('@tryghost/event-aware-cache-wrapper');
const EventRegistry = require('../../lib/common/events');
let postsCache; let postsCache;
if (config.get('hostSettings:postsPublicCache:enabled')) { if (config.get('hostSettings:postsPublicCache:enabled')) {

View file

@ -82,6 +82,7 @@
"@tryghost/email-service": "0.0.0", "@tryghost/email-service": "0.0.0",
"@tryghost/email-suppression-list": "0.0.0", "@tryghost/email-suppression-list": "0.0.0",
"@tryghost/errors": "1.2.21", "@tryghost/errors": "1.2.21",
"@tryghost/event-aware-cache-wrapper": "0.0.0",
"@tryghost/express-dynamic-redirects": "0.0.0", "@tryghost/express-dynamic-redirects": "0.0.0",
"@tryghost/helpers": "1.1.75", "@tryghost/helpers": "1.1.75",
"@tryghost/html-to-plaintext": "0.0.0", "@tryghost/html-to-plaintext": "0.0.0",