采用更快的Hash算法

This commit is contained in:
GoEdgeLab
2020-11-21 22:29:57 +08:00
parent 5485a5f663
commit d77749b0cd
12 changed files with 40 additions and 35 deletions

View File

@@ -1,7 +1,7 @@
package caches
import (
"github.com/dchest/siphash"
"github.com/cespare/xxhash"
"sync"
)
@@ -80,5 +80,5 @@ func (this *MemoryWriter) ExpiredAt() int64 {
// 计算Key Hash
func (this *MemoryWriter) hash(key string) uint64 {
return siphash.Hash(0, 0, []byte(key))
return xxhash.Sum64String(key)
}