MCPcopy Index your code
hub / github.com/coder/coder / ShouldCacheFile

Function ShouldCacheFile

site/site.go:278–298  ·  view source on GitHub ↗
(reqFile string)

Source from the content-addressed store, hash-verified

276}
277
278func 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.

Callers 2

TestShouldCacheFileFunction · 0.92
ServeHTTPMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestShouldCacheFileFunction · 0.74