diff options
author | 2016-10-02 08:31:44 +0100 | |
---|---|---|
committer | 2016-10-02 08:31:44 +0100 | |
commit | e54c232c8c97fb163647c697e921e6f69846e304 (patch) | |
tree | b75fff81276e58a2ec4417c6c6742a22d6156f27 /middleware/pkg/response/classify.go | |
parent | 9b6b8d276269cb1a36b7f78da4caa51106dff0ed (diff) | |
download | coredns-e54c232c8c97fb163647c697e921e6f69846e304.tar.gz coredns-e54c232c8c97fb163647c697e921e6f69846e304.tar.zst coredns-e54c232c8c97fb163647c697e921e6f69846e304.zip |
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
Diffstat (limited to 'middleware/pkg/response/classify.go')
-rw-r--r-- | middleware/pkg/response/classify.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/middleware/pkg/response/classify.go b/middleware/pkg/response/classify.go index 65055dff4..e22c2e0ad 100644 --- a/middleware/pkg/response/classify.go +++ b/middleware/pkg/response/classify.go @@ -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() |