MCPcopy
hub / github.com/coredns/coredns / shouldPrefetch

Method shouldPrefetch

plugin/cache/handler.go:175–182  ·  view source on GitHub ↗
(i *item, now time.Time)

Source from the content-addressed store, hash-verified

173}
174
175func (c *Cache) shouldPrefetch(i *item, now time.Time) bool {
176 if c.prefetch <= 0 {
177 return false
178 }
179 i.Update(c.duration, now)
180 threshold := int(math.Ceil(float64(c.percentage) / 100 * float64(i.origTTL)))
181 return i.Hits() >= c.prefetch && i.ttl(now) <= threshold
182}
183
184// Name implements the Handler interface.
185func (c *Cache) Name() string { return "cache" }

Callers 1

ServeDNSMethod · 0.95

Calls 3

HitsMethod · 0.80
ttlMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected