From a85905bd313080819737977136644028a2b008ac Mon Sep 17 00:00:00 2001 From: miyuko Date: Sun, 5 Oct 2025 15:05:12 +0100 Subject: [PATCH] Fix time-based cache expiration practically never working. config.MaxAge is now a nanosecond value, and multiplying it by time.Second (number of nanoseconds in a second) will make it too large for the cache expiry algorithm to have any effect. --- src/backend_s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend_s3.go b/src/backend_s3.go index 712d0e6..e5a3065 100644 --- a/src/backend_s3.go +++ b/src/backend_s3.go @@ -121,7 +121,7 @@ func makeCacheOptions[K comparable, V any]( options.Weigher = weigher } if config.MaxAge != 0 { - options.ExpiryCalculator = otter.ExpiryWriting[K, V](time.Duration(config.MaxAge) * time.Second) + options.ExpiryCalculator = otter.ExpiryWriting[K, V](time.Duration(config.MaxAge)) } return options }