mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
Replace go-cache with golang-lru in dnssec (#336)
* Replace go-cache with golang-lru This fix replace go-cache with golang-lru, as is specified in 335. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Move cache initialization to setup This commit move cache initialization to setup in dnssec middleware. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/miekg/coredns/core/dnsserver"
|
||||
"github.com/miekg/coredns/middleware"
|
||||
|
||||
"github.com/hashicorp/golang-lru"
|
||||
"github.com/mholt/caddy"
|
||||
)
|
||||
|
||||
@@ -22,8 +23,12 @@ func setup(c *caddy.Controller) error {
|
||||
return middleware.Error("dnssec", err)
|
||||
}
|
||||
|
||||
cache, err := lru.New(defaultCap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dnsserver.GetConfig(c).AddMiddleware(func(next middleware.Handler) middleware.Handler {
|
||||
return New(zones, keys, next)
|
||||
return New(zones, keys, next, cache)
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user