Skip to content

feat: implement LRU TTL refresh for S3 cache on Open#173

Open
worstell wants to merge 1 commit intomainfrom
s3-lru-ttl
Open

feat: implement LRU TTL refresh for S3 cache on Open#173
worstell wants to merge 1 commit intomainfrom
s3-lru-ttl

Conversation

@worstell
Copy link
Contributor

Problem

S3 cache entries expire based on creation time (fixed TTL). Frequently accessed snapshots expire after 72h regardless of usage, causing cold cache misses after pod restarts when no periodic jobs are running to refresh them.

Solution

Like the disk cache, S3 now resets the expiration time on each Open using a server-side copy-to-self with metadata replacement (CopyObject with ReplaceMetadata). No data is re-uploaded — only the Expires-At user metadata is updated.

Content freshness is still handled by periodic generateAndUploadSnapshot jobs (every 1h) which overwrite the S3 entry with a fresh snapshot from the latest git state.

@worstell worstell requested a review from a team as a code owner March 11, 2026 01:48
@worstell worstell requested review from stuartwdouglas and removed request for a team March 11, 2026 01:48
Like the disk cache, S3 now resets the expiration time on each Open
(read) using server-side copy-to-self with metadata replacement. This
prevents frequently accessed snapshots from expiring while periodic
snapshot jobs handle content freshness.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019cda52-ee36-738c-86cd-1fd410c47d7f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant