https://github.com/arthurfiorette/axios-cache-interceptor
📬 Small and efficient cache interceptor for axios. Etag, Cache-Control, TTL, HTTP headers and more!
https://github.com/arthurfiorette/axios-cache-interceptor
adapter ajax axios axios-cache axios-cache-interceptor axios-plugin axios-react cache cachecontrol etag http interceptor nodejs request ttl web
Last synced: about 1 month ago
JSON representation
📬 Small and efficient cache interceptor for axios. Etag, Cache-Control, TTL, HTTP headers and more!
- Host: GitHub
- URL: https://github.com/arthurfiorette/axios-cache-interceptor
- Owner: arthurfiorette
- License: mit
- Created: 2021-09-01T12:39:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-09T08:52:17.000Z (9 months ago)
- Last Synced: 2025-05-09T09:38:58.034Z (9 months ago)
- Topics: adapter, ajax, axios, axios-cache, axios-cache-interceptor, axios-plugin, axios-react, cache, cachecontrol, etag, http, interceptor, nodejs, request, ttl, web
- Language: TypeScript
- Homepage: https://axios-cache-interceptor.js.org
- Size: 14.5 MB
- Stars: 753
- Watchers: 5
- Forks: 59
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
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!
# Axios Cache Interceptor
> 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 it name says, a 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 coding himself a simple and buggy cache system.
- [Read the docs to **Learn More**.](https://axios-cache-interceptor.js.org)
- [Ask **ChatGPT** to help you with it.](https://chatgpt.com/?model=gpt-4&hints=search&prompt=You+are+a+JavaScript+expert+assistant.+Read+the+entire+content+from+the+following+URL%3A%0A%0Ahttps%3A%2F%2Faxios-cache-interceptor.js.org%2Fllms-full.txt%0AYou+are+free+to+follow+any+links+in+the+document+to+gather+more+information%2C+if+necessary.%0A%0AThe+document+is+a+comprehensive+guide+to+the+%60axios-cache-interceptor%60+library%2C+which+is+used+for+caching+HTTP+requests+in+Axios.%0A%0A**Your+task+is+to%3A**%0A%0A1.+Understand+the+purpose+and+functionality+of+the+library.%0A2.+Learn+the+key+concepts%2C+configuration+options%2C+and+API+methods+described.%0A3.+Retain+information+about+advanced+features%2C+usage+examples%2C+and+edge+cases.%0A4.+Be+ready+to+answer+technical+questions+or+explain+how+to+use+the+library%2C+troubleshoot+common+issues%2C+and+compare+it+with+other+caching+approaches+in+Axios.%0A%0ADo+not+summarize+yet.+Just+read+and+prepare+to+answer+detailed+questions.)
```ts
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; // true
```
## License
Licensed under the **MIT**. See [`LICENSE`](LICENSE) for more informations.
[](https://app.fossa.com/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor?ref=badge_small)
## Star History
## All Thanks To Our Contributors: