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: support for the Cache api #182

Merged
merged 29 commits into from
May 13, 2022
Merged

feat: support for the Cache api #182

merged 29 commits into from
May 13, 2022

Conversation

zebp
Copy link
Collaborator

@zebp zebp commented May 13, 2022

Finally adds support for the Cache api.

This is a continuation of #67 and #175

Cass Fridkin and others added 29 commits November 19, 2021 13:10
Added a "caches" type that you can only access from the worker global
scope in worker-sys so that hopefully wasm-bindgen will understand
what i want.

The abstractions in the higher level crate are for "Cache", so you never
interact with the JS global directly, and instead instantiate a cache
either by name (with a String) or with the `Default` trait, which returns
the global default cache.
The js api accepts strings and converts them into the URL for new
GET requests. By introducing the `CacheKey` type we can replicate
this behavior in rust.

Also, added some docs just ripped from https://developers.cloudflare.com/workers/runtime-apis/cache
and slightly modified for rust.
so it plays nicer with rust-analyzer etc.
…n store a response in the cache and then return it to the client
Added a "caches" type that you can only access from the worker global
scope in worker-sys so that hopefully wasm-bindgen will understand
what i want.

The abstractions in the higher level crate are for "Cache", so you never
interact with the JS global directly, and instead instantiate a cache
either by name (with a String) or with the `Default` trait, which returns
the global default cache.
The js api accepts strings and converts them into the URL for new
GET requests. By introducing the `CacheKey` type we can replicate
this behavior in rust.

Also, added some docs just ripped from https://developers.cloudflare.com/workers/runtime-apis/cache
and slightly modified for rust.
so it plays nicer with rust-analyzer etc.
…n store a response in the cache and then return it to the client
# Conflicts:
#	worker-sys/src/global.rs
#	worker-sys/src/lib.rs
#	worker/src/lib.rs
@zebp zebp mentioned this pull request May 13, 2022
@zebp zebp merged commit 030f086 into main May 13, 2022
@zebp zebp deleted the zeb/cache-api branch May 13, 2022 15:43
@cometkim
Copy link

Can I get a published version for this?

@zebp
Copy link
Collaborator Author

zebp commented May 16, 2022

Can I get a published version for this?

A release should be right around the corner, hoping to get #180 and maybe #183 merged before then but we'll do one without them if they'll take too long.

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.

3 participants