diff options
author | 2020-03-20 05:05:09 -0400 | |
---|---|---|
committer | 2020-03-20 10:05:09 +0100 | |
commit | 40c7b9174b1da59febc30a314d7ad01c48775a77 (patch) | |
tree | cd95c7cb9592a58329097499edf7d4871dee2047 /plugin/cache/cache.go | |
parent | d18b48e36c271de694563873fec108bf9c74c34d (diff) | |
download | coredns-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.go | 4 |
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) |