Move cache Keys to 64bit for a better dispersion and lower collision frequency (#2077)

* - change Key for cache to 64bits.

* - change Key for cache to 64bits.
This commit is contained in:
Francois Tur
2018-08-31 17:26:43 -04:00
committed by Yong Tang
parent d00e8c3918
commit 4c6c9d4b27
6 changed files with 43 additions and 41 deletions

View File

@@ -7,8 +7,8 @@ import (
)
// hash serializes the RRset and return a signature cache key.
func hash(rrs []dns.RR) uint32 {
h := fnv.New32()
func hash(rrs []dns.RR) uint64 {
h := fnv.New64()
buf := make([]byte, 256)
for _, r := range rrs {
off, err := dns.PackRR(r, buf, 0, nil, false)
@@ -17,6 +17,6 @@ func hash(rrs []dns.RR) uint32 {
}
}
i := h.Sum32()
i := h.Sum64()
return i
}