admin管理员组

文章数量:1406943

I have made an angular PWA and tried implementing a Network first, then Cache strategy since I want to be support offline mode for some api resources.

I have used Google Chrome to simulate no internet connection which works. But when adding a new entry into the db and then running the request when I am back online, it does not revalidate even tho I have specified it. It continues to serve the disk-cache state

Spring:

@Operation(description = UnitControllerDocs.GET_UNITS_METHOD_DESCRIPTION)
  @GetMapping
  public ResponseEntity<List<UnitDTO>> getUnits() {
    List<UnitDTO> units = unitFacade.getUnits();

    return ResponseEntity.ok()
            .header("Cache-Control", "public, max-age=31536000, must-revalidate")
            .body(units);
  }

and in my nags-config.json:

{
      "name": "select-items",
      "urls": [
        "/api/delivery-custom-fields",
        "/api/units",
        "/api/products"
      ],
      "cacheConfig": {
        "strategy": "freshness",
        "maxSize": 100,
        "maxAge": "365d",
        "timeout": "0u"
      }
    }

本文标签: