arthurfiorette / axios-cache-interceptor

📬 Small and efficient cache interceptor for axios. Etag, Cache-Control, TTL, HTTP headers and more!

Home Page:https://axios-cache-interceptor.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Invalidate all

aaronfultonnz opened this issue · comments

I'd like a feature to "invalidate all". I make heavy use of caching (front-end and backend) in my application and sometimes we need to "clear all caches". At the moment there is no easy way to do this using axios-cache-iterceptor other than keeping track of all cache keys and learning them out one by one.

let me know if you'd like me to submit a PR for this.

You can implement a custom storage for this, this is out of scope because it will be an "storage" feature that won't be used by the internals of the interceptor, which is what the storage was designed for.

If you are using memory storage, just reseting the internal data property is enough. If you are using web storages, probably just getting all local/session storage keys and deleting one by one is the solution to go for.

Let me know if you are having any more problems :)