5 Service Worker Caching Strategies for Your Next PWA App

栏目: IT技术 · 发布时间: 4年前

内容简介:“A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don’t need a web page or user interaction. Today, they already include features likeIn this blog post, I’ll focus on another

5 Service Worker Caching Strategies for Your Next PWA App

“A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don’t need a web page or user interaction. Today, they already include features like push notifications and background sync . In the future, service workers might support other things like periodic sync or geofencing.” — The Offline Cookbook

In this blog post, I’ll focus on another exciting service workers feature — intercepting and caching network requests.

Caching is one of the most exciting features of SWs. It enables us to deliver our users with a responsive and stable native-app-like experience. A web app can display some content, and perform some function, in bad network conditions and even when the user is completely offline.

We’ll cover five different caching strategies. We’ll see how and when you should implement each of them.

  • Stale-While-Revalidate
  • Cache first, then Network
  • Network first, then Cache
  • Cache only
  • Network only

I’ll address each strategy with an example to help you better understand it. You will also learn when and where to use them in your PWAs, and some assets you can use them with.


以上所述就是小编给大家介绍的《5 Service Worker Caching Strategies for Your Next PWA App》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python编程实践

Python编程实践

Jennifer Campbell、Paul Gries、Jason Montojo、Greg Wilson / 唐学韬 / 机械工业出版社华章公司 / 2011-12-31 / 49.00元

Python是当今世界流行的编程语言之一。本书共15章,通过一些短小精悍的交互式Python脚本帮助学生进行练习,并在这个过程中掌握诸如数据结构、排序和搜索算法、面向对象编程、数据库访问、图形用户界面等基本概念以及良好的程序设计风格。本书既是一本注重科学的计算机科学专业教材,也是一本目标明确的Python参考书。 本书语言风格言简意赅,图表丰富,简单实用,是一本优秀的Python入门级读物,......一起来看看 《Python编程实践》 这本书的介绍吧!

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具