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(http, server): support native ttl #479

Merged
merged 2 commits into from
Sep 5, 2024
Merged

feat(http, server): support native ttl #479

merged 2 commits into from
Sep 5, 2024

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Sep 5, 2024

Some drivers (cloudflare, vercel, and Redis) support the native ttl transaction option.

With HTTP/server pair to do remote operations, these parameters weren't passing.

This PR supports it by using the custom x-ttl HTTP header in requests for setItem and x-ttl + Cache-Control: max-age=<ttl> response headers for server HEAD/GET responses.

Note: This feature is not to pass arbitrary transaction options (as they can contain sensitive information or large payload) and also not arbitrary support of ttl as (stored) meta but only for the drivers that support it natively. in later versions we support arbitrary value+meta as FormData body.

@pi0 pi0 requested a review from atinux September 5, 2024 10:48
@pi0 pi0 self-assigned this Sep 5, 2024
Copy link

cloudflare-workers-and-pages bot commented Sep 5, 2024

Deploying unstorage with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8dbd605
Status: ✅  Deploy successful!
Preview URL: https://bba1d58a.unstorage.pages.dev
Branch Preview URL: https://feat-http-meta.unstorage.pages.dev

View logs

@pi0 pi0 merged commit 69c0583 into main Sep 5, 2024
3 checks passed
@pi0 pi0 deleted the feat/http-meta branch September 5, 2024 11:49
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