Skip to content

Commit

Permalink
small refactory on cache memory
Browse files Browse the repository at this point in the history
  • Loading branch information
peczenyj committed Feb 28, 2023
1 parent de8ebad commit d705009
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/impl/pure/cache_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ func (m *memoryCache) getShard(key string) *shard {
if len(m.shards) == 1 {
return m.shards[0]
}
h := xxhash.New64()
_, _ = h.WriteString(key)
return m.shards[h.Sum64()%uint64(len(m.shards))]

return m.shards[xxhash.ChecksumString64(key)%uint64(len(m.shards))]
}

func (m *memoryCache) Get(_ context.Context, key string) ([]byte, error) {
Expand Down

0 comments on commit d705009

Please sign in to comment.