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

Eliminate cache.writeData. #5923

Merged
merged 3 commits into from
Mar 2, 2020
Merged

Eliminate cache.writeData. #5923

merged 3 commits into from
Mar 2, 2020

Commits on Mar 2, 2020

  1. Eliminate cache.writeData, a hack worse than the alternatives.

    I referred to cache.writeData as a "foot-seeking missile" in PR #5909,
    because it's one of the easiest ways to turn your faulty assumptions about
    how the cache represents data internally into cache corruption.
    
    PR #5909 introduced an alternative api, cache.modify(id, modifiers), which
    aims to take the place of the more "surgical" uses of cache.writeData.
    However, as you can see, in almost every case where cache.writeData was
    used in our tests, an appropriate query was already sitting very close by,
    making cache.writeQuery just as easy to call.
    
    If you think your life is worse now that you have to pass a query to
    cache.writeQuery or a fragment to cache.writeFragment, please realize that
    cache.writeData was dynamically creating a fresh query or fragment behind
    the scenes, every time it was called, so it was actually doing a lot more
    work than the equivalent call to cache.writeQuery or cache.writeFragment.
    benjamn authored and hwillson committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    e3e8b66 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    36559aa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1f5b5c5 View commit details
    Browse the repository at this point in the history