aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/cache.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2020-03-20 05:05:09 -0400
committerGravatar GitHub <noreply@github.com> 2020-03-20 10:05:09 +0100
commit40c7b9174b1da59febc30a314d7ad01c48775a77 (patch)
treecd95c7cb9592a58329097499edf7d4871dee2047 /plugin/cache/cache.go
parentd18b48e36c271de694563873fec108bf9c74c34d (diff)
downloadcoredns-40c7b9174b1da59febc30a314d7ad01c48775a77.tar.gz
coredns-40c7b9174b1da59febc30a314d7ad01c48775a77.tar.zst
coredns-40c7b9174b1da59febc30a314d7ad01c48775a77.zip
plugin/cache: fix negative cache masking cases (#3744)
* fix negative cache masking cases Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove unecessary param Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/cache/cache.go')
-rw-r--r--plugin/cache/cache.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugin/cache/cache.go b/plugin/cache/cache.go
index 6b50c51cc..9988d9c70 100644
--- a/plugin/cache/cache.go
+++ b/plugin/cache/cache.go
@@ -210,6 +210,10 @@ func (w *ResponseWriter) set(m *dns.Msg, key uint64, mt response.Type, duration
case response.NoError, response.Delegation:
i := newItem(m, w.now(), duration)
w.pcache.Add(key, i)
+ // when pre-fetching, remove the negative cache entry if it exists
+ if w.prefetch {
+ w.ncache.Remove(key)
+ }
case response.NameError, response.NoData, response.ServerError:
i := newItem(m, w.now(), duration)