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: cache #120

Open
dxinteractive opened this issue Oct 18, 2018 · 2 comments
Open

Add: cache #120

dxinteractive opened this issue Oct 18, 2018 · 2 comments

Comments

@dxinteractive
Copy link
Collaborator

dxinteractive commented Oct 18, 2018

Can have a cache key that's passed props and parcel.
Entire parcel data can be cached (is it safe to cache meta?).
Cache is cleared when cacheKey changes.

Can also have a valueFromProps and an onChange to interface with React via a standard parcel "controller"

ParcelBoundaryHoc({
    ...
    cacheFromProps: (props) => props.abc
    cacheOnChange: (props) => (cache) => ???,
    cacheKeyFromProps: (value) => value.lastUpdated
})
@dxinteractive dxinteractive changed the title Add cache to ParcelBoundaryHoc Add ParcelBoundaryHoc.config.onBufferChange Oct 25, 2018
@dxinteractive dxinteractive changed the title Add ParcelBoundaryHoc.config.onBufferChange Add ParcelBoundaryHoc cache Oct 25, 2018
@dxinteractive
Copy link
Collaborator Author

How will this cache be reapplied? It makes more sense to cache the change buffer, but that's potentially huge, and would eventually involve serialising functions which adds the limitation that updater functions must be pure.

@dxinteractive
Copy link
Collaborator Author

Caching the value is fraught with problems with derived fields, and would require a whole new kind of merge algorithm that picks pieces of "new" and "old" data. Caching the change buffer is more flexible, with two added downsides:

  • will take up more space in cache
  • will mean that modifier functions and updaters must be pure. They'll need to be pure so that they are serializable.
    • potentially could make a plugin to bring selected serializable scope into an updater if people really need it

We can throw the responsibility of serializing data onto the cache storage mechanism (probably react-cool-storage)

@dxinteractive dxinteractive changed the title Add ParcelBoundaryHoc cache Add: ParcelBoundaryHoc cache Dec 5, 2018
@dxinteractive dxinteractive self-assigned this Jan 14, 2019
@dxinteractive dxinteractive removed their assignment Jan 14, 2019
@dxinteractive dxinteractive changed the title Add: ParcelBoundaryHoc cache Add: cache May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant