| 60 | } |
| 61 | |
| 62 | func 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 | |
| 80 | func lookupCachedHeader(headers []cachedHeader, name string) ([]byte, bool) { |
| 81 | for i := range headers { |