Using this package? Please consider donating to support my open source work β€οΈ
Help axios-cache-interceptor grow! Star and share this amazing repository with your friends and co-workers!
Cache interceptor for axios made with developers and performance in mind.
- β‘ Faster!
- π¦ Handy builds!
- π© Hassle free!
- π οΈ Rich Features!
- π No network waste!
- π TypeScript!
Axios Cache Interceptor is, as its name says, an interceptor for axios to handle caching. It was created to help developers call axios multiple times without having to worry about overloading the network or implementing a simple and error-prone cache system.
import Axios from 'axios';
import { setupCache } from 'axios-cache-interceptor';
const instance = Axios.create();
const axios = setupCache(instance);
const req1 = axios.get('https://arthur.place/');
const req2 = axios.get('https://arthur.place/');
const [res1, res2] = await Promise.all([req1, req2]);
res1.cached; // false
res2.cached; // trueLicensed under the MIT. See LICENSE for more information.