MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / AddServerCache

Method AddServerCache

agent/utils/nginx/components/location.go:305–313  ·  view source on GitHub ↗
(cacheKey string, serverCacheTime int, serverCacheUint string)

Source from the content-addressed store, hash-verified

303}
304
305func (l *Location) AddServerCache(cacheKey string, serverCacheTime int, serverCacheUint string) {
306 l.UpdateDirective("proxy_ignore_headers", []string{"Set-Cookie", "Cache-Control", "expires"})
307 l.UpdateDirective("proxy_cache", []string{cacheKey})
308 l.UpdateDirective("proxy_cache_key", []string{"$host$uri$is_args$args"})
309 l.UpdateDirective("proxy_cache_valid", []string{"200", "304", "301", "302", strconv.Itoa(serverCacheTime) + serverCacheUint})
310 l.Cache = true
311 l.ServerCacheTime = serverCacheTime
312 l.ServerCacheUint = serverCacheUint
313}
314
315func (l *Location) RemoveBrowserCache() {
316 l.RemoveDirectiveByFullParams("if", []string{"(", "$uri", "~*", `"\.(gif|png|jpg|css|js|woff|woff2)$"`, ")"})

Callers 1

OperateProxyMethod · 0.95

Calls 1

UpdateDirectiveMethod · 0.95

Tested by

no test coverage detected