# simple-swr

> SimpleSWR is a lightweight and efficient caching adapter for Axios.

Latest version **1.0.2** (published 2023-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-swr
pnpm add simple-swr
yarn add simple-swr
bun add simple-swr
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-12-27 |
| First published | 2023-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Neo |
| Maintainers | neo-aircode |
| Keywords | axios, swr, cache, http, pinia swr, vue swr |

## Links

- npm: https://www.npmjs.com/package/simple-swr
- Repository: https://github.com/AirCodeLabs/SimpleSWR
- Issues: https://github.com/AirCodeLabs/SimpleSWR/issues
- npm.io page: https://npm.io/package/simple-swr

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.6.3

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-12-27
- 1.0.1 — 2023-12-27
- 1.0.0 — 2023-12-27

## README

# 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

```javascript
// 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

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

---
_Source: https://npm.io/package/simple-swr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
