#307 Add ipp.shareCacheTime and cachebusted link after an upload

This commit is contained in:
Alan Grainger
2026-10-19 14:42:43 +13:00
parent 8bf1d753aa
commit a958559247
11 changed files with 159 additions and 11 deletions
+9 -1
View File
@@ -12,6 +12,7 @@ import {
cachedPromise,
fetchSharedLink,
getConfigOption,
getNumericConfigOption,
invalidPasswordResponse,
isKey,
log,
@@ -46,8 +47,15 @@ import { h } from 'preact'
read-only. In-place mutation persists for the cache lifetime and leaks
across concurrent requests. The assets are sorted into display order here,
before caching, so no caller needs to sort them; clone before mutating.
The TTL is `ipp.shareCacheTime`, so it bounds how long a visitor's upload
takes to reach the gallery. It is read on each `set` because this cache is
built at import time, before the config is loaded.
*/
const shareCache = new TtlLruCache<Promise<SharedLinkResult>>({ ttlMs: 120_000, max: 100 })
const shareCache = new TtlLruCache<Promise<SharedLinkResult>>({
ttlMs: () => Math.max(1, getNumericConfigOption('ipp.shareCacheTime', 120)) * 1000,
max: 100
})
/*
Per-asset detail cache for the lazy album flow. When a `needsDetail` album