Add Cache Storage API / Cache API #3122

Open
addyosmani opened this Issue Jan 20, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@addyosmani

The Cache API allow authors to fully and conveniently manage their content caches for offline use. An origin can have multiple, named Cache objects which are accessible via workers and document scripts.

As of Chrome 43 (and Opera 30) this has been available globally and outside of the Service Worker context (meaning you can use it standalone). The feature was implemented back in Firefox 39, but IIRC not yet exposed to the global context. Afaik, it's in development for Edge.

I might suggest treating it as a top-level storage item in a similar way to how IDB is treated today: http://caniuse.com/#feat=indexeddb. Over on Chrome our storage team are recommending developers use the Cache API for URL addressable resources and IDB for everything else atm. Can has? :)

Docs + samples:
https://googlechrome.github.io/samples/service-worker/window-caches/index.html
https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage
https://developer.mozilla.org/en-US/docs/Web/API/Cache

@Schweinepriester

This comment has been minimized.

Show comment
Hide comment
@Schweinepriester

Schweinepriester Jun 14, 2017

Contributor

+1

https://developer.mozilla.org/en-US/Firefox/Releases/55:

  • The StorageManager.persist() and StorageManager.persisted() methods of the Storage API have been implemented and exposed to Window contexts
  • The Storage API is now available only to secure contexts

EDIT, 2017-12-19:

MDN: https://developer.mozilla.org/en-US/docs/Web/API/Cache

Edge: Per https://developer.microsoft.com/en-us/microsoft-edge/platform/changelog/desktop/17063/?compareWith=16299 in Edge 17+:

The Service Workers family of features (Service Worker, Push API, Cache API, Fetch API) is now enabled by default in Microsoft Edge.

Contributor

Schweinepriester commented Jun 14, 2017

+1

https://developer.mozilla.org/en-US/Firefox/Releases/55:

  • The StorageManager.persist() and StorageManager.persisted() methods of the Storage API have been implemented and exposed to Window contexts
  • The Storage API is now available only to secure contexts

EDIT, 2017-12-19:

MDN: https://developer.mozilla.org/en-US/docs/Web/API/Cache

Edge: Per https://developer.microsoft.com/en-us/microsoft-edge/platform/changelog/desktop/17063/?compareWith=16299 in Edge 17+:

The Service Workers family of features (Service Worker, Push API, Cache API, Fetch API) is now enabled by default in Microsoft Edge.

@rivsc

This comment has been minimized.

Show comment
Hide comment

rivsc commented Feb 21, 2018

+1 :)

@hassanalami

This comment has been minimized.

Show comment
Hide comment

+1

@jimmywarting

This comment has been minimized.

Show comment
Hide comment
Contributor

jimmywarting commented May 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment