优化xxhash和fnv相关代码

This commit is contained in:
刘祥超
2024-04-18 18:25:33 +08:00
parent 96cb816200
commit 91f817d2d2
12 changed files with 61 additions and 18 deletions

View File

@@ -1,7 +1,11 @@
package ttlcache
import "github.com/cespare/xxhash"
import "github.com/cespare/xxhash/v2"
func HashKey(key []byte) uint64 {
func HashKeyBytes(key []byte) uint64 {
return xxhash.Sum64(key)
}
func HashKeyString(key string) uint64 {
return xxhash.Sum64String(key)
}