# expeditious-engine-memory

> store expeditious cache entries using process memory

Latest version **0.2.1** (published 2017-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install expeditious-engine-memory
pnpm add expeditious-engine-memory
yarn add expeditious-engine-memory
bun add expeditious-engine-memory
```

## 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.2.1 |
| Published | 2017-10-18 |
| First published | 2016-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Evan Shortiss |
| Maintainers | evanshortiss |
| Keywords | expeditious, engine, memory, cache |

## Links

- npm: https://www.npmjs.com/package/expeditious-engine-memory
- npm.io page: https://npm.io/package/expeditious-engine-memory

## Dependencies (1)

- [expeditious](https://npm.io/package/expeditious.md) ~1.0.0

## 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.2.1 (latest) — 2017-10-18
- 0.2.0 — 2016-12-01
- 0.1.0 — 2016-07-04

## README

expeditious-engine-memory
=========================
[![Circle CI](https://circleci.com/gh/evanshortiss/expeditious-engine-memory/tree/master.svg?style=svg)](https://circleci.com/gh/evanshortiss/expeditious-engine-memory/tree/master)

An in memory engine for expeditious. Cache entries are - you guessed it -
stored in the node.js process memory. This cache engine will lose everything
stored if your process restarts, and could lead to memory bloat and slow
garbage collections if you're not careful with the size and volume of entries!

## Usage
You can use this module standalone or with expeditious which is the
recommended approach since it simplifies interactions and allows you to easily
switch cache engines.

```js
var expeditious = require('expeditious');

var countries = expeditious({
  // Use the expeditious memory engine
  engine: require('expeditious-engine-memory')(),
  // Prefix all entries with 'countries'
  namespace: 'countries',
  // Auto parse json entries
  objectMode: true,
  // 1 hour timeout for entries
  defaultTtl: (60 * 1000 * 60),
});

countries.set({
  key: 'ireland',
  value: {
    population: '4.595 million',
    capital: 'Dublin'
  }
}, function (err) {
  if (!err) {
    console.error('failed to add "ireland" to the cache');
  } else {
    console.log('add "ireland" to the cache');
  }
});
```

## API
Each API function takes a callback function as the last parameter and it
receives up to two arguments as per node.js convention, error _err_ and an
optional result, _res_.

#### set(key, value, expire, callback)
Set a _key_ (String) in the cache with a given (String) _value_. _expire_ must
be a Number greater than 0.

#### get(key, callback)
Get a specific item from the cache. Returns _null_ if the entry is
not found.

#### del(key, callback)
Delete a specific item from the cache. Callback receives only an error
parameter.

#### keys(callback)
List all keys that this engine instance contains.

#### ttl(key, callback)
Get the time left before _key_ expires. Returns _null_ as _res_ if the entry is
not found.

#### flush(callback)
Flush all items from the engine instance.

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