Skip to content

Commit

Permalink
Avoid redundant key parsing from the wrappedEntry. (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyahui committed Dec 22, 2023
1 parent 8f5979b commit 1864b07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bigcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ func (c *BigCache) notProvidedOnRemove(wrappedEntry []byte, reason RemoveReason)
}

func (c *BigCache) providedOnRemoveWithMetadata(wrappedEntry []byte, reason RemoveReason) {
hashedKey := c.hash.Sum64(readKeyFromEntry(wrappedEntry))
key := readKeyFromEntry(wrappedEntry)

hashedKey := c.hash.Sum64(key)
shard := c.getShard(hashedKey)
c.config.OnRemoveWithMetadata(readKeyFromEntry(wrappedEntry), readEntry(wrappedEntry), shard.getKeyMetadata(hashedKey))
c.config.OnRemoveWithMetadata(key, readEntry(wrappedEntry), shard.getKeyMetadata(hashedKey))
}

0 comments on commit 1864b07

Please sign in to comment.