# json-simple-cache

> A javascript library to do actions and store return in a json cache file. focused in small projects

Latest version **1.0.12** (published 2018-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-simple-cache
pnpm add json-simple-cache
yarn add json-simple-cache
bun add json-simple-cache
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2018-08-05 |
| First published | 2018-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vinicios de Lima Clarindo |
| Maintainers | vinicioslc |
| Keywords | cache, json, javascript, server, simple |

## Links

- npm: https://www.npmjs.com/package/json-simple-cache
- npm.io page: https://npm.io/package/json-simple-cache

## Dependencies (1)

- [simple-json-db](https://npm.io/package/simple-json-db.md) 1.2.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.12 (latest) — 2018-08-05
- 1.0.1 — 2018-08-05
- 1.0.0 — 2018-08-05

## README

# json-simple-cache

## Example sending a web request if not be cached

```javascript
const SimpleCache = require('json-simple-cache')
const cacheManager = new SimpleCache({
    path: './caching/myfile',//path to your cache file
    expiration: 20000 // your expiration time in milliseconds defaults is equals 1 week
})

const yourObjectIdentifier = "http://www.example.com/address?lat=2456.2151&lng=12125.1251"

var myResultCachedOrNot = cacheManager.doCachedRequest( yourObjectIdentifier, () => {
    return myAwesomeWebRequest() // myAwesomeWebRequest will be returned if the cached identifier is not found or outdated
})
/*.....
```

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