pmndrs / suspend-react

🚥 Async/await for React components
MIT License
1.37k stars 25 forks source link

Add ability to create a local cache instance #16

Open lindskogen opened 1 year ago

lindskogen commented 1 year ago

We're generating a lot of cache keys in our app, and would like to clear all keys under a specific "namespace".

  1. My first idea was to add the ability to clear keys by prefix, but searching through all the keys seems like a bad idea for perf.
  2. My other suggestion is to create a cache specific to each use-case in the app, and a clear function to delete the whole list in that namespace.

This seemed like more in-line with the direction the React team are taking with scoped cache.

We're already using this solution in our production app with great results :)

lindskogen commented 1 year ago

Sorry. I updated the description now!