MCPcopy
hub / github.com/gofiber/fiber / isHeuristicFreshness

Function isHeuristicFreshness

middleware/cache/utils.go:62–78  ·  view source on GitHub ↗
(e *item, cfg *Config, entryAge uint64)

Source from the content-addressed store, hash-verified

60}
61
62func isHeuristicFreshness(e *item, cfg *Config, entryAge uint64) bool {
63 const heuristicAgeThresholdSeconds = uint64(24 * time.Hour / time.Second)
64 if entryAge <= heuristicAgeThresholdSeconds {
65 return false
66 }
67
68 if len(e.expires) > 0 {
69 return false
70 }
71
72 cacheControl := utils.UnsafeString(e.cacheControl)
73 if parsedCC := parseResponseCacheControl(utils.UnsafeBytes(cacheControl)); parsedCC.maxAgeSet || parsedCC.sMaxAgeSet {
74 return false
75 }
76
77 return cfg.Expiration > 0
78}
79
80func lookupCachedHeader(headers []cachedHeader, name string) ([]byte, bool) {
81 for i := range headers {

Callers 2

NewFunction · 0.85

Calls 1

Tested by 1