-
Notifications
You must be signed in to change notification settings - Fork 319
Commit c8ab714
authored
Refine Cache API (#1190)
* Remove incumbent/fetching record from Cache behavior
- Remove the incumbent/fetching record concept that allowed committing
a fetching resource to cache and match/matchAll to return a fully
written existing resource, if any, with priority over a fetching
resource. After this change, add/addAll/put promises resolve when the
resources ared fully fetched and committed to cache. match/matchAll
will not return any on-going fetching resources.
- Change the specification type of underlying cache objects from a map
(request to response map) to a list (request response list). The
change is to make the arguments and the return values of the Cache
methods and algorithms (Batch Cache Operations and Query Cache)
conform to one another. The list type seems fine as the algorithms
tend to iterate through the list to find certain items with search
options.
* Correct the use of objects associated to JS realm and global
- Replace CacheBatchOperations dictionary which isn't exposed to
JavaScript surface with cache batch operations struct.
- Do not store JS objects in the storage but store request and response
structs instead.
- Create and return JS objects in the target realm when requested (from
matchAll() and keys()).
* Refactor algorithms
- Simplify "put" operation related steps by moving/refactoring the
post-Batch Cache Operation steps, which clear the invalid items, from
addAll() and put() into Batch Cache Operations.
- Move the argument validation steps of cache.keys() out of the
parallel thread to main thread.
- Fix cacheStorage.keys() to run the steps async.
- Change to early-exit in fetch abort cases.
- Fix async steps of fulfillment handlers.
- Change the interface of Batch Cache Operations algorithm.
. Change to not return a promise
. Remove the in parallel steps and make it work synchronously
. Change the call sites to call it in a created promise's in parallel
steps
Fixes #884.
* NB: HTML files in this commit aren't updated due to huge merge
conflicts. A separate commit with the updated HTMLs will follow this
commit with a proper link to it.1 parent 698dfd9 commit c8ab714Copy full SHA for c8ab714
0 commit comments