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.
This commit is contained in:
parent
da230cd1fa
commit
f1b280de53
3 changed files with 0 additions and 8 deletions
2
plugin/cache/README.md
vendored
2
plugin/cache/README.md
vendored
|
@ -47,8 +47,6 @@ cache [TTL] [ZONES...] {
|
||||||
which defaults to `10%`. Values should be in the range `[10%, 90%]`. Note the percent sign is
|
which defaults to `10%`. Values should be in the range `[10%, 90%]`. Note the percent sign is
|
||||||
mandatory. **PERCENTAGE** is treated as an `int`.
|
mandatory. **PERCENTAGE** is treated as an `int`.
|
||||||
|
|
||||||
The minimum TTL allowed on resource records is 5 seconds.
|
|
||||||
|
|
||||||
## Metrics
|
## Metrics
|
||||||
|
|
||||||
If monitoring is enabled (via the *prometheus* directive) then the following metrics are exported:
|
If monitoring is enabled (via the *prometheus* directive) then the following metrics are exported:
|
||||||
|
|
2
plugin/cache/cache.go
vendored
2
plugin/cache/cache.go
vendored
|
@ -168,8 +168,6 @@ const (
|
||||||
maxTTL = 1 * time.Hour
|
maxTTL = 1 * time.Hour
|
||||||
maxNTTL = 30 * time.Minute
|
maxNTTL = 30 * time.Minute
|
||||||
|
|
||||||
minTTL = 5 // seconds
|
|
||||||
|
|
||||||
defaultCap = 10000 // default capacity of the cache.
|
defaultCap = 10000 // default capacity of the cache.
|
||||||
|
|
||||||
// Success is the class for caching positive caching.
|
// Success is the class for caching positive caching.
|
||||||
|
|
4
plugin/cache/item.go
vendored
4
plugin/cache/item.go
vendored
|
@ -68,10 +68,6 @@ func (i *item) toMsg(m *dns.Msg) *dns.Msg {
|
||||||
m1.Extra = make([]dns.RR, len(i.Extra))
|
m1.Extra = make([]dns.RR, len(i.Extra))
|
||||||
|
|
||||||
ttl := uint32(i.ttl(time.Now()))
|
ttl := uint32(i.ttl(time.Now()))
|
||||||
if ttl < minTTL {
|
|
||||||
ttl = minTTL
|
|
||||||
}
|
|
||||||
|
|
||||||
for j, r := range i.Answer {
|
for j, r := range i.Answer {
|
||||||
m1.Answer[j] = dns.Copy(r)
|
m1.Answer[j] = dns.Copy(r)
|
||||||
m1.Answer[j].Header().Ttl = ttl
|
m1.Answer[j].Header().Ttl = ttl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue