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

Primitives: Implement Cache as CacheStorage interfaces #51

Open
Kikobeats opened this issue Jul 26, 2022 · 0 comments
Open

Primitives: Implement Cache as CacheStorage interfaces #51

Kikobeats opened this issue Jul 26, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Kikobeats
Copy link
Member

Kikobeats commented Jul 26, 2022

The CacheStorage is holding all the

A CacheStorage object represents a name to cache map of its associated global object's:

self.caches // CacheStorage {}
self.caches instanceof CacheStorage // true

You can create a new Cache namespace there, and it will be an instance:

const cache = await caches.open('my_cache')
cache instanceof Cache // true

Additionally, CF Workers exposes a default single global cache object:

const cache = caches.default
cache instanceof Cache

This cache is a bit special: Since the spec actually doesn't provide any way to manipulate the cache that backs fetch(), if you put something into it, then fetch() will match that thing.

@Kikobeats Kikobeats added the enhancement New feature or request label Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant