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

Hoist cache.modify method declaration to ApolloCache. #6362

Merged
merged 1 commit into from
May 29, 2020

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented May 29, 2020

Background: #6350 (comment)

The cache.modify method and its related types are fairly InMemoryCache-specific, which is why it felt safest to confine cache.modify to InMemoryCache when I brought it back in #6350. In practice, however, that confinement just makes cache.modify harder to use (annoyingly, not helpfully) in cases where an ApolloCache is all that's available.

You could also argue that cache.modify has roughly the same standing (in terms of InMemoryCache-specificity) as cache.identify or cache.gc, which are also part of the "Optional API" of the ApolloCache base class. In that sense, cache.modify is simply joining those other AC3 APIs as part of ApolloCache (and thus also InMemoryCache).

#6350 (comment)

The modify method and its related types are fairly InMemoryCache-specific,
which is why it felt safest to confine cache.modify to InMemoryCache when
I brought it back in #6350. In practice, however, that confinement just
makes cache.modify harder to use (annoyingly, not helpfully) in cases
where an ApolloCache is all that's available.

You could also argue that cache.modify has roughly the same standing (in
terms of InMemoryCache-specificity) as cache.identify or cache.gc, which
are also part of the "Optional API" of the ApolloCache base class. In that
sense, cache.modify is simply joining those other AC3 APIs in ApolloCache.
@@ -33,6 +34,13 @@ export namespace Cache {
broadcast?: boolean;
}

export interface ModifyOptions {
Copy link
Member Author

Choose a reason for hiding this comment

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

Feels right to have Cache.ModifyOptions declared alongside Cache.EvictOptions again.

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

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

Looks great @benjamn - thanks!

@benjamn benjamn merged commit dae6b6f into master May 29, 2020
@benjamn benjamn deleted the hoist-cache.modify-to-ApolloCache branch May 29, 2020 23:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants