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"
}
}
本文标签:
版权声明:本文标题:Cannot get Network first, then Cache strategy to work with Angular and Spring Boot - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745049359a2639556.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论