aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-05 10:05:49 +0200
committerChocobozzz <me@florianbigard.com>2023-06-05 10:05:49 +0200
commited14d1ebd7c8d9428ac58b3a6280e3df6686aec1 (patch)
treebf3caf6f5f9a46069b5080272fd427af3fbd6fbb /server/middlewares
parent96290a6b78ce1ecba5f91faaa08cdd941331af4b (diff)
downloadPeerTube-ed14d1ebd7c8d9428ac58b3a6280e3df6686aec1.tar.gz
PeerTube-ed14d1ebd7c8d9428ac58b3a6280e3df6686aec1.tar.zst
PeerTube-ed14d1ebd7c8d9428ac58b3a6280e3df6686aec1.zip
Invalidate cache feed even after server restart
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/cache/shared/api-cache.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/middlewares/cache/shared/api-cache.ts b/server/middlewares/cache/shared/api-cache.ts
index c6197b972..b50b7dce4 100644
--- a/server/middlewares/cache/shared/api-cache.ts
+++ b/server/middlewares/cache/shared/api-cache.ts
@@ -35,7 +35,11 @@ export class ApiCache {
35 // Cache keys per group 35 // Cache keys per group
36 private groups: { [groupIndex: string]: string[] } = {} 36 private groups: { [groupIndex: string]: string[] } = {}
37 37
38 private readonly seed: number
39
38 constructor (options: APICacheOptions) { 40 constructor (options: APICacheOptions) {
41 this.seed = new Date().getTime()
42
39 this.options = { 43 this.options = {
40 headerBlacklist: [], 44 headerBlacklist: [],
41 excludeStatus: [], 45 excludeStatus: [],
@@ -88,7 +92,7 @@ export class ApiCache {
88 } 92 }
89 93
90 private getCacheKey (req: express.Request) { 94 private getCacheKey (req: express.Request) {
91 return Redis.Instance.getPrefix() + 'api-cache-' + req.originalUrl 95 return Redis.Instance.getPrefix() + 'api-cache-' + this.seed + '-' + req.originalUrl
92 } 96 }
93 97
94 private shouldCacheResponse (response: express.Response) { 98 private shouldCacheResponse (response: express.Response) {