优化本地数据库性能

This commit is contained in:
刘祥超
2022-03-15 18:32:39 +08:00
parent ddebc0e4a8
commit 21e206061d
13 changed files with 940 additions and 515 deletions

View File

@@ -0,0 +1,19 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package fnv
const (
offset64 uint64 = 14695981039346656037
prime64 uint64 = 1099511628211
)
// Hash
// 非unique Hash
func Hash(key string) uint64 {
var hash = offset64
for _, b := range key {
hash ^= uint64(b)
hash *= prime64
}
return hash
}