Skip to content

Comments

feature/1: Changing getter function to be called at lookup time inste…#2

Merged
ChrisSandison merged 10 commits intomainfrom
feature/1
May 29, 2023
Merged

feature/1: Changing getter function to be called at lookup time inste…#2
ChrisSandison merged 10 commits intomainfrom
feature/1

Conversation

@ChrisSandison
Copy link

…ad of defined as part of the cache.

For instance, when the getter function takes something like the reporter then this can't be used

Fixes #1

@ChrisSandison ChrisSandison requested a review from kbirk May 26, 2023 07:45
@ChrisSandison ChrisSandison self-assigned this May 26, 2023
@ChrisSandison ChrisSandison merged commit 87578b7 into main May 29, 2023
return value, false
}

func (c *partitionedCache[K, V]) Put(key K, value *V) {
Copy link

@kbirk kbirk May 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't originally add Put because you can't use it without introducing a race condition between it and Get. The Get and Put operations have to be atomic and behave similar to a compare and swap.

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.

Value Getter function should be given at lookup time, not on definition

2 participants