Remove the unused cache lifetime setting (closes #69)
check / check (push) Waiting to run

CacheConfig.CacheTTL was set to DefaultCacheTTL (24 hours) and never
read, so cached images never expired. Remove the field, the constant
and the line that set it. Cached source and transformed images stay
until eviction removes them to keep the cache within cache_max_bytes.

A new test caches a source and a transformed image, sets back two days
fetched_at in source_metadata and source_content, created_at in
variant_content, the fetched_at in the source's metadata file, the
created_at in the .meta file, and the access and modification times of
those two files and of the two image files, and checks that both are
still served from the cache without a new upstream fetch.

Existing tests lose only the CacheTTL line of their cache config.

Model: opus-5-5
This commit is contained in:
2026-10-13 03:58:40 +00:00
parent 162a2a33ef
commit 89d7055382
14 changed files with 171 additions and 18 deletions
@@ -70,7 +70,6 @@ func newEvictionTestCache(t *testing.T, maxBytes int64) (*Cache, string) {
// backwards compatibility with existing fixtures.
cache, err := NewCache(db, CacheConfig{
StateDir: tmpDir,
CacheTTL: time.Hour,
NegativeTTL: 5 * time.Minute,
MaxBytes: maxBytes,
DisableDiskCache: maxBytes == 0,