question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strong caching for object inputs

See original GitHub issue

If 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:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dai-shicommented, May 5, 2021

Hmmm, it’s going to be really strange without option object… Gave up. Let’s use option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP caching - MDN Web Docs
The HTTP cache stores a response associated with a request and reuses the stored response for subsequent requests.
Read more >
All things caching- use cases, benefits, strategies, choosing a ...
In-Memory Caching: Suitable to store any key value or objects directly accessible through run time memory in the same node.
Read more >
What is Caching and How it Works - AWS
The data in a cache is generally stored in fast access hardware such as RAM (Random-access memory) and may also be used in...
Read more >
Options for optimizing caching in React - LogRocket Blog
Cover solutions for optimizing cache management in React applications, like memorization, virtual selectors, lazy loading, and fragments.
Read more >
Advanced Python: How To Implement Caching In ... - Medium
We need a mechanism to link the inputs to the outputs of a function and store them in memory. This brings us to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found