# mono-cache

> support ( memory & redis & upstash ) drive in nodejs

Latest version **2.0.0** (published 2023-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install mono-cache
pnpm add mono-cache
yarn add mono-cache
bun add mono-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.0.0 |
| Published | 2023-10-12 |
| First published | 2023-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 90.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 杨伟杰 |
| Maintainers | sia-fl |
| Keywords | mono, cache, redis, memory |

## Links

- npm: https://www.npmjs.com/package/mono-cache
- Repository: https://github.com/sia-fl/mono-cache
- Homepage: https://github.com/sia-fl/mono-cache#readme
- Issues: https://github.com/sia-fl/mono-cache/issues
- npm.io page: https://npm.io/package/mono-cache

## 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

- 2.0.0 (latest) — 2023-10-12
- 1.0.10 — 2023-10-05
- 1.0.9 — 2023-10-02
- 1.0.8 — 2023-10-01
- 1.0.7 — 2023-10-01
- 1.0.6 — 2023-10-01
- 1.0.5 — 2023-09-30
- 1.0.4 — 2023-09-30
- 1.0.3 — 2023-09-30
- 1.0.2 — 2023-09-30
- 1.0.1 — 2023-09-30
- 1.0.0 — 2023-09-30

## README

# mono-cache <a href="https://npm.im/mono-cache"><img src="https://badgen.net/npm/v/mono-cache"></a> <a href="https://npm.im/mono-cache"><img src="https://badgen.net/npm/dm/mono-cache"></a> <a href="https://packagephobia.now.sh/result?p=mono-cache">

install to npm dependencies :

```
npm i -D mono-cache
```

usage:

```typescript
import cache from 'mono-cache';

interface CacheState {
  name: string;
  age: number;

  next: {
    weight: number;
    height: number;
  };
}

const c = cache<CacheState>();
c.set('name', 'mono-cache');
c.set('age', 18);
c.set('next.weight', 60);
c.set('next.height', 180);

const name = c.get('name');
const age = c.get('age');
const next = c.get('next');
console.log(name, age, next);

// ttl

c.set('name', 'mono-cache', 1000); // 1000 = 1s

// how to get result type on get method ?

import { CachePaths } from './type';

const nextPaths: CachePaths<CacheState> = 'next';
const typedNext = c.get<typeof nextPaths>(nextPaths);
console.log(typedNext.weight, typedNext.height);
```

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