# omni-cache

> Memory cache for server side

Latest version **0.0.2** (published 2020-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install omni-cache
pnpm add omni-cache
yarn add omni-cache
bun add omni-cache
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-04-29 |
| First published | 2020-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AndreOneti |
| Maintainers | andreoneti |
| Keywords | cache, memory-cache, memory, server-cache |

## Links

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

## Dependencies (1)

- [typescript](https://npm.io/package/typescript.md) ^3.8.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

- 0.0.2 (latest) — 2020-04-29
- 0.0.1 — 2020-04-29

## README

# omni-cache

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Maintenance][maintenance-img]][maintenance-url]
[![GitHub issues][issues-open-image]][issues-open-url]

<br>

Simple memory cache from server side.

<br>

## How to

### Install

``` sh
npm i --save omni-cache
or
yarn add omni-cache
```

<hr>

### Use

#### Without options on create

``` javascript

const { Cache } = require('omni-cache');

const cache = new Cache();

cache.put('myKey', 'myValue', 1500);              // Time im ms
cache.get('myKey');                               // myValue
cache.keys();                                     // [ 'myKey' ]
cache.size();                                     // 1
cache.debug(true);                                // No return
cache.inDebug();                                  // true
cache.exportJson();                               // true
cache.del('myKey');                               // true
cache.clear();                                    // No return

```
<hr>

#### With options on create

``` javascript

const { Cache } = require('omni-cache');

const cache = new Cache({
  debug: true,
  ttl: 1500
});

cache.put('myKey', 'myValue');                    // Expire time id ttl by default
cache.get('myKey');                               // myValue
cache.keys();                                     // [ 'myKey' ]
cache.size();                                     // 1
cache.inDebug();                                  // true
cache.debug(false);                               // No return
cache.inDebug();                                  // false
cache.exportJson();                               // true
cache.del('myKey');                               // true
cache.clear();                                    // No return

```

<br>
<hr>

[![npm](https://img.shields.io/npm/l/express.svg)](https://github.com/AndreOneti/omni-cache/blob/master/LICENSE)

[npm-image]: https://img.shields.io/npm/v/omni-cache.svg
[npm-url]: https://npmjs.org/package/omni-cache
[downloads-image]: https://img.shields.io/npm/dm/omni-cache.svg
[downloads-url]: https://npmjs.org/package/omni-cache
[maintenance-img]: https://img.shields.io/badge/Maintained%3F-yes-green.svg
[maintenance-url]: https://github.com/AndreOneti/omni-cache
[issues-open-image]: https://img.shields.io/github/issues/AndreOneti/omni-cache.svg
[issues-open-url]: https://github.com/AndreOneti/omni-cache/issues?q=is%3Aopen+is%3Aissue

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