2021-09-01 16:43:08 -03:00
2021-09-01 16:20:54 -03:00
2021-09-01 13:37:28 -03:00
2021-09-01 16:34:54 -03:00
2021-09-01 16:20:54 -03:00
2021-09-01 16:20:54 -03:00
2021-09-01 16:20:54 -03:00
2021-09-01 10:07:10 -03:00
2021-09-01 10:07:10 -03:00
2021-09-01 16:36:27 -03:00
2021-09-01 16:38:35 -03:00
2021-09-01 16:20:54 -03:00


  

🗄️📦💿 Axios Cache Interceptor




Forks Issues Stars License



This library is in beta and can have breaking changes until v1.
Not ready for production usage!


axios-cache-interceptor is a axios wrapper for caching and preventing unneeded requests


import axios from 'axios';
import { createCache, SessionCacheStorage } from 'axios-cache-interceptor';

// Any custom axios instance
const api = axios.create();

// Other axios instance with caching enabled
const cache = createCache(api, {
  // Store values on window.sessionStorage
  storage: new SessionCacheStorage(),

  // Use the max-age header to determine the cache expiration time
  interpretHeader: true
});

// Exactly the same as before
cache.get('http://example.com/');


Installing

# Npm
npm install --save axios-cache-interceptor

# Yarn
yarn add axios-cache-interceptor

Inspiration

This project is highly inspired by several projects, written entirely in typescript, supporting https headers and much more.

Take a look at some similar projects:


License

Licensed under the MIT. See LICENSE for more informations.


Contact

See my contact information on my github profile or open a new issue.


Description
📬 Small and efficient cache interceptor for axios. Etag, Cache-Contol, TTL, HTTP headers and more!
Readme MIT 67 MiB
Languages
TypeScript 97.2%
JavaScript 1.5%
Shell 1.3%