1.0.2 • Published 6 months ago

simple-swr v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

SimpleSWR

SimpleSWR is a lightweight and efficient caching adapter for Axios, implementing the Stale While Revalidate (SWR) strategy. It's designed to enhance the performance of HTTP requests by caching responses and revalidating them in the background.

Because of its simplicity, it can be used in a variety of repositories for data state management, including Vue's Pinia.

Key Features:

  • Efficient Caching: Reduce network load by caching Axios responses.
  • SWR Strategy: Automatically revalidate cached data to ensure freshness.
  • Easy Integration: Seamlessly integrates with existing Axios instances.

Installation

npm i simple-swr

Quick Start

// Example of using SimpleSWR
import simpleSWR from 'simple-swr';

// Fetch response with caching
const response = await simpleSWR.get('/api/example');
const data = response.data;

Parameters

// You can also setup cache duration
simpleSWR.setup({ cacheDuration: 1000 * 60 * 5 });
1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago