mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
middleware/cache: split cache in positive and negative and use lru (#298)
Make the cache memory bounded, by using a LRU cache. Also split the
cache in a positive and negative one - each with its own controls.
Extend the cache stanza to allow for this:
cache {
positive limit [ttl]
negative limit [ttl]
}
is now possible. This also add a cache_test.go in the toplevel test/
directory that exercises the caching path.
Fixes #260
This commit is contained in:
@@ -18,6 +18,22 @@ const (
|
||||
OtherError
|
||||
)
|
||||
|
||||
func (t Type) String() string {
|
||||
switch t {
|
||||
case Success:
|
||||
return "NOERROR"
|
||||
case NameError:
|
||||
return "NXDOMAIN"
|
||||
case NoData:
|
||||
return "NODATA"
|
||||
case Delegation:
|
||||
return "DELEGATION"
|
||||
case OtherError:
|
||||
return "OTHERERROR"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Classify classifies a message, it returns the Type.
|
||||
func Classify(m *dns.Msg) (Type, *dns.OPT) {
|
||||
opt := m.IsEdns0()
|
||||
|
||||
Reference in New Issue
Block a user