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

feat(cloudflare-kv-http): support ttl for setItem #448

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

SolarisUp
Copy link
Contributor

πŸ”— Linked issue

#32

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Add new feature - ttl for storage data in KV via http. This feature prevent extra costs for using KV and resolve #32

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@SolarisUp
Copy link
Contributor Author

To check the exact implementation from the Wrangler developers, you can go to this GitHub link

@pi0 pi0 changed the title feat: Add ttl for CF KV http driver feat(cloudflare-kv-http): support ttl option May 21, 2024
Copy link

codecov bot commented May 21, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 66.59%. Comparing base (4d61c78) to head (2ddeba3).
Report is 61 commits behind head on main.

Files with missing lines Patch % Lines
src/drivers/cloudflare-kv-http.ts 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
+ Coverage   65.05%   66.59%   +1.53%     
==========================================
  Files          39       39              
  Lines        4055     4131      +76     
  Branches      487      511      +24     
==========================================
+ Hits         2638     2751     +113     
+ Misses       1408     1371      -37     
  Partials        9        9              

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@SolarisUp
Copy link
Contributor Author

@pi0 hi, do I need to cover the code with tests? Also, when can this code be released?

@sisou
Copy link

sisou commented Jun 11, 2024

From the code of the bindings Cloudflare KV driver (cloudflare-kv-binding.ts), it looks like that one doesn't support the ttl shorthand. However, it accepts the forwarded 3rd argument, so using expirationTtl should already work. Maybe you can add ttl support to that, too, if expirationTtl is not specified, but ttl is.

@barberj
Copy link
Contributor

barberj commented Aug 5, 2024

@sisou How is this approach: #470

@pi0 pi0 changed the title feat(cloudflare-kv-http): support ttl option feat(cloudflare-kv-http): support ttl for setItem Sep 4, 2024
@pi0
Copy link
Member

pi0 commented Sep 4, 2024

Thanks!

@pi0 pi0 merged commit 2cd4266 into unjs:main Sep 4, 2024
3 of 4 checks passed
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.

Use Cloudflare KV native meta
4 participants