Skip to content

Commit

Permalink
Adding support for explicit no-cache policy for positive/negative dns…
Browse files Browse the repository at this point in the history
… queries
  • Loading branch information
uruddarraju committed Feb 21, 2019
1 parent 3c23aac commit 77378e2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugin/cache/cache.go
Expand Up @@ -203,12 +203,16 @@ func (w *ResponseWriter) set(m *dns.Msg, key uint64, mt response.Type, duration
// and key is valid
switch mt {
case response.NoError, response.Delegation:
i := newItem(m, w.now(), duration)
w.pcache.Add(key, i)
if w.pcap > 0 {
i := newItem(m, w.now(), duration)
w.pcache.Add(key, i)
}

case response.NameError, response.NoData:
i := newItem(m, w.now(), duration)
w.ncache.Add(key, i)
if w.ncap > 0 {
i := newItem(m, w.now(), duration)
w.ncache.Add(key, i)
}

case response.OtherError:
// don't cache these
Expand Down

0 comments on commit 77378e2

Please sign in to comment.