Open shhonarmandi opened 5 months ago
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Thank you for your PR!
As you mentioned, although the default Cache object is implemented with Map
internally, it doesn't mean the Cache must be Map.
We intentionally restrict the Cache interface to only APIs SWR uses internally so that users can implement their own Cache store without relying on Map
.
Let me consider the clearing cache feature separately.
@koba04
Thank you for your feedback.
I updated the pull request and removed unnecessary methods and properties as you mentioned.
This commit updates the type definition of the Cache object to align with the native JavaScript Map data structure. This offers users access to clear method available on Map.
cache.clear(): Removes all key-value pairs from the cache (useful scenarios include user logout).
Relevant issue: https://github.com/vercel/swr/issues/2877