Skip to content

Conversation

@bitfaster
Copy link
Owner

@bitfaster bitfaster commented Jul 31, 2024

There is a lock in TryUpdate to prevent concurrent updates, but no item lock on TryRemove(kvp). No lock is needed for TryRemove(key) because updates to the value do not affect the outcome - key should always be removed. The value is important in the kvp variant however (#371), where the equivalent lock was missed leading to a race when the value changes between finding the existing LruItem and removing it.

@coveralls
Copy link

Coverage Status

coverage: 99.209%. remained the same
when pulling 0fbf72e on users/alexpeck/updremkvp
into f9563f8 on main.

@bitfaster bitfaster merged commit f682e88 into main Jul 31, 2024
@bitfaster bitfaster deleted the users/alexpeck/updremkvp branch July 31, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TryRemove(KeyValuePair<K, V>) removes item even when value doesn't match

3 participants