aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Tobias Schmidt <tobidt@gmail.com> 2018-01-11 18:06:49 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2018-01-11 17:06:49 +0000
commitf1b280de537adab09ce1af8bfd2894ad315fff76 (patch)
tree485d9df155ca3e18e79a687ffd621e069a211db5 /plugin
parentda230cd1facfd8c4440fde539c6e2c933213cd56 (diff)
downloadcoredns-f1b280de537adab09ce1af8bfd2894ad315fff76.tar.gz
coredns-f1b280de537adab09ce1af8bfd2894ad315fff76.tar.zst
coredns-f1b280de537adab09ce1af8bfd2894ad315fff76.zip
Remove TTL ceiling at 5s in plugin/cache (#1380)
The cache plugin always returned a minimum TTL of 5 seconds, regardless of the actual TTL of the records. A cache is not authoritative for the record TTL and should not extend it.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/cache/README.md2
-rw-r--r--plugin/cache/cache.go2
-rw-r--r--plugin/cache/item.go4
3 files changed, 0 insertions, 8 deletions
diff --git a/plugin/cache/README.md b/plugin/cache/README.md
index edbc6f8fc..556b76c0d 100644
--- a/plugin/cache/README.md
+++ b/plugin/cache/README.md
@@ -47,8 +47,6 @@ cache [TTL] [ZONES...] {
which defaults to `10%`. Values should be in the range `[10%, 90%]`. Note the percent sign is
mandatory. **PERCENTAGE** is treated as an `int`.
-The minimum TTL allowed on resource records is 5 seconds.
-
## Metrics
If monitoring is enabled (via the *prometheus* directive) then the following metrics are exported:
diff --git a/plugin/cache/cache.go b/plugin/cache/cache.go
index 85e7e1bb8..caa38d1f0 100644
--- a/plugin/cache/cache.go
+++ b/plugin/cache/cache.go
@@ -168,8 +168,6 @@ const (
maxTTL = 1 * time.Hour
maxNTTL = 30 * time.Minute
- minTTL = 5 // seconds
-
defaultCap = 10000 // default capacity of the cache.
// Success is the class for caching positive caching.
diff --git a/plugin/cache/item.go b/plugin/cache/item.go
index 2c215617b..d67906c81 100644
--- a/plugin/cache/item.go
+++ b/plugin/cache/item.go
@@ -68,10 +68,6 @@ func (i *item) toMsg(m *dns.Msg) *dns.Msg {
m1.Extra = make([]dns.RR, len(i.Extra))
ttl := uint32(i.ttl(time.Now()))
- if ttl < minTTL {
- ttl = minTTL
- }
-
for j, r := range i.Answer {
m1.Answer[j] = dns.Copy(r)
m1.Answer[j].Header().Ttl = ttl