Resource Caching
pwa:
serviceworker:
enabled: true
src: "sw.js"
workbox:
resource_caches:
- match_callback: 'startsWith: /pages/'
cache_name: 'static-pages'
strategy: 'NetworkFirst'
network_timeout: 2 # Wait only 2 seconds (only when strategy is networkFirst or NetworkOnly)
preload_urls: # List of URLs to preload. The URLs shall match the value in match_callback option
- 'page_tos'
- 'page_legal'
- match_callback: 'regex: \/articles\/.*$'
cache_name: 'articles'
strategy: 'StaleWhileRevalidate'
broadcast: true # Broadcast changes only when strategy = staleWhileRevalidate
preload_urls: # List of URLs to precache. The URL shall be comprised within the regex
- 'app_articles'
- path: 'app_top_articles'
params:
display: 5Match Callback
Regular Expression
Javascript Callback
Prefixed Statements
Pattern
Description
Example
Custom Match Callback Handler
Cache Name Parameter
Strategy Parameter
Network Timeout
Max Entries / Max Age
Range Requests
Broadcast Parameter
Broadcast Header
Cacheable Responses
Last updated
Was this helpful?