From c7ff44fb3a4ac782108980b7d91803f341ec1614 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 13 Oct 2017 17:22:08 +0200 Subject: [PATCH] plugin/cache: don't update freq is prefetch isn't used. (#1144) Small optimization. --- plugin/cache/handler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/cache/handler.go b/plugin/cache/handler.go index f3f2e675b..b7824beba 100644 --- a/plugin/cache/handler.go +++ b/plugin/cache/handler.go @@ -34,7 +34,9 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) resp, _ = state.Scrub(resp) w.WriteMsg(resp) - i.Freq.Update(c.duration, now) + if c.prefetch > 0 { + i.Freq.Update(c.duration, now) + } pct := 100 if i.origTTL != 0 { // you'll never know