zoukankan      html  css  js  c++  java
  • [Angular] Performance Caching Policy

    If you want to cache API response by using angular service-worker, you can do it in:

    src/ngsw-config.json:

    {
      "index": "/index.html",
      "assetGroups": [{
        "name": "app",
        "installMode": "prefetch",
        "resources": {
          "files": [
            "/favicon.ico",
            "/index.html"
          ],
          "versionedFiles": [
            "/*.bundle.css",
            "/*.bundle.js",
            "/*.chunk.js"
          ]
        }
      }, {
        "name": "assets",
        "installMode": "lazy",
        "updateMode": "prefetch",
        "resources": {
          "files": [
            "/assets/**"
          ]
        }
      }],
      // cache for API data
      "dataGroups": [
        {
          "name": "lessons-api",
          "urls": [
            "/api/lessons"
          ],
          "cacheConfig": {
            "strategy": "performance", // cache first, network last
            "maxAge": "1d",
            "maxSize": 100
          }
        }
      ]
    }
  • 相关阅读:
    Angular(一)
    多变的形状
    二叉树
    快速排序
    冒泡排序
    插入排序
    大话程序猿眼里的高并发架构
    整屏滚动
    增加删除一行标签
    无缝滚动
  • 原文地址:https://www.cnblogs.com/Answer1215/p/8879040.html
Copyright © 2011-2022 走看看