* Fix max-age in http server Move the minMsgTTL to dnsutil and rename it MinimalTTL, move some constants there as well. Use these new function in server_https to correctly set the max-age HTTP header. Fixes: #1823 * Linter
This allocates memory because of the append, just unroll the loop. Also add benchmark. Before: goos: linux goarch: amd64 pkg: github.com/coredns/coredns/plugin/cache BenchmarkCacheResponse-4 100000 11910 ns/op BenchmarkMinMsgTTL-4 1000000 1494 ns/op PASS After: goos: linux goarch: amd64 pkg: github.com/coredns/coredns/plugin/cache BenchmarkCacheResponse-4 100000 12016 ns/op BenchmarkMinMsgTTL-4 2000000 668 ns/op PASS
See https://github.com/kubernetes/kubernetes/pull/53604, explicitaly add test to make sure we do the right thing.