# @stellaraf/cacheutil

> Stellar JS Cache Utilities

Latest version **1.0.0** (published 2022-09-20) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @stellaraf/cacheutil
pnpm add @stellaraf/cacheutil
yarn add @stellaraf/cacheutil
bun add @stellaraf/cacheutil
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-09-20 |
| First published | 2022-09-20 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 8 |
| Unpacked size | 434.1 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | checktheroads |

## Links

- npm: https://www.npmjs.com/package/@stellaraf/cacheutil
- npm.io page: https://npm.io/package/@stellaraf/cacheutil

## Dependencies (8)

- [turbo](https://npm.io/package/turbo.md) ^1.4.6
- [eslint](https://npm.io/package/eslint.md) ^8.23.1
- [prettier](https://npm.io/package/prettier.md) ^2.7.1
- [typescript](https://npm.io/package/typescript.md) ^4.8.2
- [@types/jest](https://npm.io/package/@types/jest.md) ^29.0.2
- [@types/node](https://npm.io/package/@types/node.md) ^18.7.18
- [@changesets/cli](https://npm.io/package/@changesets/cli.md) ^2.24.4
- [@stellaraf/eslint-config](https://npm.io/package/@stellaraf/eslint-config.md) ^1.1.4

## Recent versions

- 1.0.0 (latest) — 2022-09-20

## README

<div align="center">
  <br/>
  <img src="https://res.cloudinary.com/stellaraf/image/upload/v1604277355/stellar-logo-gradient.svg" width="300" />
  <br/>
  <h3>Stellar JS Cache Utilities</h3>
  <br/>
  <a href="https://github.com/stellaraf/cacheutil/actions?query=workflow%3ATests">
    <img src="https://img.shields.io/github/workflow/status/stellaraf/cacheutil/Tests?color=%239100fa&event=push&style=for-the-badge" />
  </a>
  <br/>
  <br/>
</div>

`@stellaraf/cacheutil` provides a consistent caching API with support for multiple backends, in the event that a library requires a cache but could be used on multiple platforms with different caching systems available. For example, if one needed use a library on both Cloudflare Workers and a standard NodeJS application.

# Supported Backends

## Cloudflare KV

```ts
import { createCache } from "@stellaraf/cacheutil-cache";

const cache = createCache(env.KV_BINDING);

await cache.set("key", "value");
const value = await cache.get("key");
console.log(value);
// value
```

## Redis

```ts
import { createCache } from "@stellaraf/cacheutil-cache";

const cache = createCache({ url: "redis://localhost:6379", database: 1 });

await cache.set("key", "value");
const value = await cache.get("key");
console.log(value);
// value
```

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