Skip to content

Commit

Permalink
feat: Applies PR review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkheir committed Nov 2, 2023
1 parent 0086967 commit 76e25b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ func (s *cacheShard) getValidWrapEntry(key string, hashedKey uint64) ([]byte, er

func (s *cacheShard) contains(key string, hashedKey uint64) bool {
s.lock.RLock()
defer s.lock.RUnlock()
wrappedEntry, err := s.getWrappedEntry(hashedKey)
if err != nil {
s.lock.RUnlock()
return false
}
return key == readKeyFromEntry(wrappedEntry)
entryKey := readKeyFromEntry(wrappedEntry)
s.lock.RUnlock()
return key == entryKey
}

func (s *cacheShard) set(key string, hashedKey uint64, entry []byte) error {
Expand Down

0 comments on commit 76e25b3

Please sign in to comment.