Skip to content

Commit cffbf48

Browse files
authored
rename resetKeyFromEntry to resetHashFromEntry (#361)
1 parent 791a4b0 commit cffbf48

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

encoding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ func readHashFromEntry(data []byte) uint64 {
7878
return binary.LittleEndian.Uint64(data[timestampSizeInBytes:])
7979
}
8080

81-
func resetKeyFromEntry(data []byte) {
81+
func resetHashFromEntry(data []byte) {
8282
binary.LittleEndian.PutUint64(data[timestampSizeInBytes:], 0)
8383
}

shard.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (s *cacheShard) set(key string, hashedKey uint64, entry []byte) error {
124124

125125
if previousIndex := s.hashmap[hashedKey]; previousIndex != 0 {
126126
if previousEntry, err := s.entries.Get(int(previousIndex)); err == nil {
127-
resetKeyFromEntry(previousEntry)
127+
resetHashFromEntry(previousEntry)
128128
//remove hashkey
129129
delete(s.hashmap, hashedKey)
130130
}
@@ -176,7 +176,7 @@ func (s *cacheShard) addNewWithoutLock(key string, hashedKey uint64, entry []byt
176176
func (s *cacheShard) setWrappedEntryWithoutLock(currentTimestamp uint64, w []byte, hashedKey uint64) error {
177177
if previousIndex := s.hashmap[hashedKey]; previousIndex != 0 {
178178
if previousEntry, err := s.entries.Get(int(previousIndex)); err == nil {
179-
resetKeyFromEntry(previousEntry)
179+
resetHashFromEntry(previousEntry)
180180
}
181181
}
182182

@@ -265,7 +265,7 @@ func (s *cacheShard) del(hashedKey uint64) error {
265265
if s.statsEnabled {
266266
delete(s.hashmapStats, hashedKey)
267267
}
268-
resetKeyFromEntry(wrappedEntry)
268+
resetHashFromEntry(wrappedEntry)
269269
}
270270
s.lock.Unlock()
271271

@@ -332,7 +332,7 @@ func (s *cacheShard) removeOldestEntry(reason RemoveReason) error {
332332
if err == nil {
333333
hash := readHashFromEntry(oldest)
334334
if hash == 0 {
335-
// entry has been explicitly deleted with resetKeyFromEntry, ignore
335+
// entry has been explicitly deleted with resetHashFromEntry, ignore
336336
return nil
337337
}
338338
delete(s.hashmap, hash)

0 commit comments

Comments
 (0)