Skip to content

Commit

Permalink
Merge pull request redpanda-data#1779 from peczenyj/small-refactor-on…
Browse files Browse the repository at this point in the history
…-cache-memory

small refactory on cache memory
  • Loading branch information
Jeffail authored Mar 21, 2023
2 parents a4376ab + d705009 commit 8ead0a9
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 8ead0a9

Please sign in to comment.