[io PWA] Great libraries and tools for great Progressive Web Apps

  • sw-toolbox: Github
    •   It provides a cononical implementation of all the runtime caching strategies that you need for you dynamice content.
  • sw-precache: Github
    •   It takes care of caching and maintaing all the resources in your app shell
  • sw-helpers: Github
  • lighthouse: Github

 

 

sw-toolbox:

For the assets, you can use cache-first:

CacheFirst, will go to cache for fetching data, if there is then return the cache back, will not go to network for fetching data.

If cannot get the data from the cache, then fallback to network to get data.

toolbox.router.get(
    '/path/to/images/.*',
    toolbox.cacheFirst,
    {cache: {
        name: 'images',
        maxEnteries: 6  // cache at most 6 images
    }}
)

 

For highly dynamic data, can use network first: (Battle Lie-Fi)

NetworkFirst, will go network for fetching data, if get the data then return back.

If cannot get the data, then fallback to cache.

复制代码
toolbox.router.get(
    '/posts/.*',
    toolbox.networkFist,
    {cache: {
        name: 'posts',
        maxEnteries: 500,
        maxAgeSeconds: 5 * 24 * 60 * 60
    },
   networkTimeoutSeconds: 3 // after three sconds, fallback to cache
  } )
复制代码

 

Fastest: 

Race between cache and network:

 

 

 

posted @   Zhentiw  阅读(200)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示