aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/handler.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-10-13 17:22:08 +0200
committerGravatar GitHub <noreply@github.com> 2017-10-13 17:22:08 +0200
commitc7ff44fb3a4ac782108980b7d91803f341ec1614 (patch)
tree3af7efb09562bfed72752da2c4b3698cf6c8ad83 /plugin/cache/handler.go
parent8ed730e1cb6332fcdeb2f83228449335ebf80a5b (diff)
downloadcoredns-c7ff44fb3a4ac782108980b7d91803f341ec1614.tar.gz
coredns-c7ff44fb3a4ac782108980b7d91803f341ec1614.tar.zst
coredns-c7ff44fb3a4ac782108980b7d91803f341ec1614.zip
plugin/cache: don't update freq is prefetch isn't used. (#1144)
Small optimization.
Diffstat (limited to 'plugin/cache/handler.go')
-rw-r--r--plugin/cache/handler.go4
1 files changed, 3 insertions, 1 deletions
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