Strong caching for object inputs
See original GitHub issueIf I understand correctly, the library keeps two caches: a “weak” cache (WeakMap
) and a “strong” cache (Map
). The weak cache is used for object inputs; the strong cache for primitive inputs.
I would really like to be able to pass an object to the store’s methods while benefiting from the strong caching strategy.
Right now, I’ve written a little wrapper store that calls JSON.stringify
(and JSON.parse
on the way out) so that my input objects are transformed into strings in order to get the strong caching strategy. It works fine, but it’d be nice if createFetchStore
could support it out of the box with some configuration options of sorts. The ideal would probably be to allow passing custom stringify
and parse
functions to pre- and post-process the inputs/results.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
https://www.npmjs.com/package/react-suspense-fetch/v/0.4.0
Hmmm, it’s going to be really strange without option object… Gave up. Let’s use option.