Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in cachehash that wouldn't update a key-value pair if the key was already in the cache #376

Merged
merged 8 commits into from
Jun 5, 2024

Conversation

phillip-stephens
Copy link
Contributor

@phillip-stephens phillip-stephens commented Jun 4, 2024

Context

While working on adding linters, govet spotted that the assignment to kv here within the Add function was ineffectual.

Since this is very core logic, I split this off into a separate PR so it can get focused attention.

Changes

  • Changed Add -> Upsert to be more accurate
  • Simplified if logic
  • Update value if key is present in cache
  • Add unit test for above
  • Add function comment

@phillip-stephens phillip-stephens marked this pull request as ready for review June 5, 2024 21:53
@phillip-stephens phillip-stephens requested a review from a team as a code owner June 5, 2024 21:53
@zakird zakird merged commit c6d1627 into main Jun 5, 2024
3 checks passed
@zakird zakird deleted the phillip/cachehash-add branch June 5, 2024 22:03
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.

2 participants