diff options
author | 2022-03-18 10:13:58 -0700 | |
---|---|---|
committer | 2022-03-18 10:13:58 -0700 | |
commit | 90fd1ceb01edac2b08efb8cf61e11a5a903ee2e0 (patch) | |
tree | 3b393565d755f4f78575f2a56cbe11c6211c6e40 | |
parent | 90680b7077a932177c1b90ca3c8c1e35dd1a1b30 (diff) | |
download | coredns-90fd1ceb01edac2b08efb8cf61e11a5a903ee2e0.tar.gz coredns-90fd1ceb01edac2b08efb8cf61e11a5a903ee2e0.tar.zst coredns-90fd1ceb01edac2b08efb8cf61e11a5a903ee2e0.zip |
Avoid copy of large value in `range` (#5243)
-rw-r--r-- | plugin/pkg/cache/cache.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugin/pkg/cache/cache.go b/plugin/pkg/cache/cache.go index 5105c4f7d..6c4105e7c 100644 --- a/plugin/pkg/cache/cache.go +++ b/plugin/pkg/cache/cache.go @@ -66,7 +66,7 @@ func (c *Cache) Remove(key uint64) { // Len returns the number of elements in the cache. func (c *Cache) Len() int { l := 0 - for _, s := range c.shards { + for _, s := range &c.shards { l += s.Len() } return l @@ -74,7 +74,7 @@ func (c *Cache) Len() int { // Walk walks each shard in the cache. func (c *Cache) Walk(f func(map[uint64]interface{}, uint64) bool) { - for _, s := range c.shards { + for _, s := range &c.shards { s.Walk(f) } } |