# js-smart-request-cache

> a small wrapper for fetch

Latest version **2.2.0** (published 2023-06-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install js-smart-request-cache
pnpm add js-smart-request-cache
yarn add js-smart-request-cache
bun add js-smart-request-cache
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2023-06-07 |
| First published | 2020-11-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Raade GmbH |
| Maintainers | raade |
| Keywords | network, fetch |

## Links

- npm: https://www.npmjs.com/package/js-smart-request-cache
- Repository: https://github.com/raadegmbh/js-smart-request-cache
- Homepage: https://github.com/raadegmbh/js-smart-request-cache#readme
- Issues: https://github.com/raadegmbh/js-smart-request-cache/issues
- npm.io page: https://npm.io/package/js-smart-request-cache

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2023-06-07
- 2.1.0 — 2021-08-16
- 2.0.0 — 2021-07-22
- 1.0.0 — 2020-11-18

## README

# js-smart-request-cache

## `RequestHelper`

**Signature**:

```js
class RequestHelper {
    static timeToExpireInMilliseconds: number; // the time (milliseconds) it takes to invalidate the cached value.
    static GET(url: string, fetchOptions?: object, forceRequest?: boolean, responseType?: RequestResponseType, acceptableStatusCodes?: number[]): Promise<any>;
}
```

**Example**:
```js
RequestHelper.timeToExpireInMilliseconds = 10000;

RequestHelper.GET("https://example.com/api/orders?id=1", {
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
    },
    false,
    RequestResponseType.Json,
    [200, 201]
})
    .then((response) => {
        // Handle Response ...
    })
    .catch((e) => {
        // Handle Error ...
    });
```

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