(reqFile string)
| 276 | } |
| 277 | |
| 278 | func ShouldCacheFile(reqFile string) bool { |
| 279 | // Images, favicons and uniquely content hashed bundle assets should be |
| 280 | // cached. By default, we cache everything in the site/out directory except |
| 281 | // for deny-listed items enumerated here. The reason for this approach is that |
| 282 | // cache invalidation techniques should be used by default for all build |
| 283 | // processed assets. The scenarios where we don't use cache invalidation |
| 284 | // techniques are one-offs or things that should have invalidation in the |
| 285 | // future. |
| 286 | denyListedSuffixes := []string{ |
| 287 | ".html", |
| 288 | "worker.js", |
| 289 | } |
| 290 | |
| 291 | for _, suffix := range denyListedSuffixes { |
| 292 | if strings.HasSuffix(reqFile, suffix) { |
| 293 | return false |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | return true |
| 298 | } |
| 299 | |
| 300 | // reportHTMLFirstServedAt sends a telemetry report when the first HTML is ever served. |
| 301 | // The purpose is to track the first time the first user opens the site. |
no outgoing calls