Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Use KV key expiry to cost effectively remove cache keys #298

Closed
AdiRishi opened this issue Feb 19, 2024 · 0 comments · Fixed by #449
Closed

[Feature]: Use KV key expiry to cost effectively remove cache keys #298

AdiRishi opened this issue Feb 19, 2024 · 0 comments · Fixed by #449
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@AdiRishi
Copy link
Owner

Problem Description

At the moment KV cache is set and deleted the same way as R2. That is to say, the deletion cron will loop over all available keys and delete the ones past the expiration time configured on the project.

This is not very cost effective for KV, as list operations are billed at $5/million. While in R2 we don't have much of a choice here, in KV we can effectively use the expiry option to avoid the cost of manually looping and deleting expired keys.

Proposed Solution

I'm not 100% clear on how I would solve this, since it involves breaking the storage layer abstraction we've defined in this project since v3. My current thoughts are

  • It might be ok to break the abstraction to solve the cost issue
  • Perhaps the storage interface can expose some mechanism that abstracts the concept of expiry in a way that works for both R2 and KV (plus any future storage solutions)
@AdiRishi AdiRishi added enhancement New feature or request help wanted Extra attention is needed labels Feb 19, 2024
@AdiRishi AdiRishi added good first issue Good for newcomers and removed help wanted Extra attention is needed labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
1 participant