aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2018-10-16 09:24:40 -0400
committerGravatar Yong Tang <yong.tang.github@outlook.com> 2018-10-16 06:24:40 -0700
commit4a5641c3793a750c1a0323f09678f3429b9b5649 (patch)
tree19070cdef66f87d98ed341d67656f2dc1860dcac /plugin
parent8cc8afa96a9cabe132417368e10aaa138e0b8aae (diff)
downloadcoredns-4a5641c3793a750c1a0323f09678f3429b9b5649.tar.gz
coredns-4a5641c3793a750c1a0323f09678f3429b9b5649.tar.zst
coredns-4a5641c3793a750c1a0323f09678f3429b9b5649.zip
plugin/cache: Set min TTL default to zero (#2199)
* set min ttl default to zero * add short TTL test case
Diffstat (limited to 'plugin')
-rw-r--r--plugin/cache/README.md4
-rw-r--r--plugin/cache/cache.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/plugin/cache/README.md b/plugin/cache/README.md
index 5f1980794..1c9f03da3 100644
--- a/plugin/cache/README.md
+++ b/plugin/cache/README.md
@@ -41,10 +41,10 @@ cache [TTL] [ZONES...] {
* **TTL** and **ZONES** as above.
* `success`, override the settings for caching successful responses. **CAPACITY** indicates the maximum
number of packets we cache before we start evicting (*randomly*). **TTL** overrides the cache maximum TTL.
- **MINTTL** overrides the cache minimum TTL, which can be useful to limit queries to the backend.
+ **MINTTL** overrides the cache minimum TTL (default 0), which can be useful to limit queries to the backend.
* `denial`, override the settings for caching denial of existence responses. **CAPACITY** indicates the maximum
number of packets we cache before we start evicting (LRU). **TTL** overrides the cache maximum TTL.
- **MINTTL** overrides the cache minimum TTL, which can be useful to limit queries to the backend.
+ **MINTTL** overrides the cache minimum TTL (default 0), which can be useful to limit queries to the backend.
There is a third category (`error`) but those responses are never cached.
* `prefetch` will prefetch popular items when they are about to be expunged from the cache.
Popular means **AMOUNT** queries have been seen with no gaps of **DURATION** or more between them.
diff --git a/plugin/cache/cache.go b/plugin/cache/cache.go
index 9ff43dac2..4b6cb4101 100644
--- a/plugin/cache/cache.go
+++ b/plugin/cache/cache.go
@@ -239,9 +239,9 @@ func (w *ResponseWriter) Write(buf []byte) (int, error) {
const (
maxTTL = dnsutil.MaximumDefaulTTL
- minTTL = dnsutil.MinimalDefaultTTL
+ minTTL = 0
maxNTTL = dnsutil.MaximumDefaulTTL / 2
- minNTTL = dnsutil.MinimalDefaultTTL
+ minNTTL = 0
defaultCap = 10000 // default capacity of the cache.