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

Implement EntityCache as replacement for DepTrackingCache and ObjectCache. #5197

merged 9 commits into from Aug 21, 2019


Copy link

commented Aug 16, 2019

The new EntityCache is like the old DepTrackingCache in that it can track dependencies to enable caching repeated reads (#3394). However, the EntityCache also incorporates the OptimisticCacheLayer logic (#4319) that was previously implemented in inMemoryCache.ts, thereby providing the same result caching benefits for optimistic cache reads, while preserving the possibility of reading non-optimistic data while optimistic data are still active.

The EntityCache also removes the need for both the ObjectCache and the MapCache, which were alternate cache implementations one could theoretically use instead of the default DepTrackingCache.

By moving optimistic caching logic into the same area of the code that handles non-optimistic caching, this PR sets the stage for garbage collection (see also #4681), since automatic garbage collection needs to take into account the full contents of the cache, including optimistic data.

benjamn added 7 commits Aug 14, 2019
Remove no-longer-used objectCache.ts and associated tests.
This could be a breaking change, since the exports of objectCache.ts were
previously re-exported by index.ts, whereas now we re-export the exports
of entityCache.ts.

@benjamn benjamn added this to the Release 3.0 milestone Aug 16, 2019

@benjamn benjamn self-assigned this Aug 16, 2019

book: {
__typename: 'Book',
isbn: '9781451673319',
title: 'Fahrenheit 451',

This comment has been minimized.

Copy link

benjamn Aug 16, 2019

Author Contributor

Extremely trivial fun fact: this completely authentic ISBN number for Fahrenheit 451 contains 451 as adjacent digits. 📚🔥

benjamn added 2 commits Aug 16, 2019

@benjamn benjamn requested review from hwillson and jbaxleyiii Aug 16, 2019

Copy link

left a comment

Looks great @benjamn! 👍

@benjamn benjamn merged commit 33d9dcc into release-3.0 Aug 21, 2019

7 checks passed

CLA Author has signed the Meteor CLA.
bundlesize Total bundle size is 19.12KB/19.25KB (-null)
ci/circleci: Apollo Client Monorepo Your tests passed on CircleCI!
ci/circleci: Danger Your tests passed on CircleCI!
ci/circleci: Filesize Your tests passed on CircleCI!
codecov/project 90.24% (target 80%)
netlify/apollo-client-docs/deploy-preview Deploy preview ready!

This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2019

Merging this so that @hwillson can go ahead and work on restructuring the repo starting from the release-3.0 branch.

@benjamn benjamn deleted the enable-result-caching-for-optimistic-reads branch Aug 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.