Caching adapter for axios that stores GET request results in a configurable store to prevent unnecessary network requests. Current stable version is 2.7.3, with releases following a maintenance cadence. The library provides two main APIs: setupCache() for creating a standalone cache adapter, and setup() for creating a pre-configured axios instance. It supports per-request cache configuration and uses localForage as the default store. Unlike other axios caching solutions, it relies on localForage for cross-browser IndexedDB/WebSQL/LocalStorage support. Requires peer dependency axios ~0.21.1.
npm install axios-cache-adapterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Setup a cache adapter with 15-minute cache lifetime and use it with a fresh axios instance.
Use cache.adapter as shown in the quickstart
Use cache.store.clear() or cache.store.removeItem(key)
Add methods to exclude.methods or set exclude.methods: ['post','put','delete']
Install axios@0.21.1 or later
Set exclude.query: false in cache options to include query parameters in cache key
Set store: null to use an in-memory store instead, or configure a custom store
Use named import: import { setupCache } from 'axios-cache-adapter'Ensure axios version is ~0.21.1 and do: axios.create({ adapter: cache.adapter })Install localforage: npm install localforage, or configure a custom store
Use setup() like: const api = setup({...}). Then api.cache.length works.