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

add getKey and forgetKey API (#188) #189

Merged
merged 3 commits into from
May 8, 2021

Conversation

sofianhn
Copy link
Contributor

Per the conversation in apollographql/apollo-feature-requests#289, add getKey & forgetKey API's to OptimisticWrapperFunction.

The motive here is to keep track of the cached entries without having to memoize the arguments and duplicate the logic for weakly tracking them. This will enable the creators of OptimisticWrapperFunction to use the true keys for removing entries via the forgetKey API.

@sofianhn
Copy link
Contributor Author

@brainkim here is the PR per our conversation.

Copy link
Owner

@benjamn benjamn left a comment

Choose a reason for hiding this comment

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

Regardless of how we use these APIs in the short term, I think it's worthwhile to have -Key versions of each of the functions attached to the optimistic wrapper function. I kept your getKey and forgetKey functions, but added dirtyKey and peekKey, along with exposing the makeCacheKey function in case folks need it.

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