The axios-cache-interceptor package is a middleware for Axios that provides caching capabilities. It allows you to cache HTTP requests and responses, reducing the number of network requests and improving performance.
What are axios-cache-interceptor's main functionalities?
Basic Caching
This feature allows you to set up basic caching for your Axios requests. The example demonstrates how to create a cache with a maximum age of 15 minutes and use it with an Axios instance.
This feature allows you to manually invalidate the cache for specific requests. The example demonstrates how to invalidate the cache for a specific URL.
const axios = require('axios');
const { setupCache } = require('axios-cache-interceptor');
const cache = setupCache();
const api = axios.create({
adapter: cache.adapter
});
api.get('https://api.example.com/data')
.then(response => console.log(response.data))
.catch(error => console.error(error));
// Invalidate the cache for a specific request
cache.invalidate({ url: 'https://api.example.com/data' });
axios-cache-adapter is another caching library for Axios. It provides similar functionality to axios-cache-interceptor, allowing you to cache HTTP requests and responses. However, axios-cache-adapter offers more configuration options for cache storage, such as using localStorage or a custom store.
axios-extensions is a package that extends Axios with additional features, including caching. It provides a simple way to add caching to your Axios requests and supports various cache strategies. Compared to axios-cache-interceptor, axios-extensions offers more flexibility in defining cache strategies and expiration times.
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.
The npm package axios-cache-interceptor receives a total of 99,244 weekly downloads. As such, axios-cache-interceptor popularity was classified as popular.
We found that axios-cache-interceptor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Package last updated on 22 Oct 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.