# memcached-elasticache

> A memcached client with support for auto-discovery of AWS ElastiCache nodes

Latest version **1.1.1** (published 2017-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install memcached-elasticache
pnpm add memcached-elasticache
yarn add memcached-elasticache
bun add memcached-elasticache
```

## 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.1.1 |
| Published | 2017-12-21 |
| First published | 2017-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Jeff Kehres |
| Maintainers | jkehres |
| Keywords | elasticache, memcached, autodiscovery |

## Links

- npm: https://www.npmjs.com/package/memcached-elasticache
- Repository: https://github.com/jkehres/memcached-elasticache
- Homepage: https://github.com/jkehres/memcached-elasticache#readme
- Issues: https://github.com/jkehres/memcached-elasticache/issues
- npm.io page: https://npm.io/package/memcached-elasticache

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0
- [memcached](https://npm.io/package/memcached.md) ^2.2.2

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

- 1.1.1 (latest) — 2017-12-21
- 1.1.0 — 2017-08-25
- 1.0.2 — 2017-07-18
- 1.0.1 — 2017-07-18
- 1.0.0 — 2017-07-13

## README

# memcached-elasticache

Drop-in replacement for [`memcached`](https://github.com/3rd-Eden/memcached) module (a fully featured Memcached client for Node.js) that adds support for [auto-discovery](http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.html) of nodes in an AWS ElastiCache cluster running the Memcached engine. Works with all AWS supported cache engine versions.

## Installation

`npm install memcached-elasticache`

## Setting up the client

The constructor of the client takes two arguments `server locations` and `options`:

```js
const Memcached = require('memcached-elasticache');
const memcached = new Memcached(Server locations, options);
```

### Server locations

When auto-discovery is enabled (default), specify the configuration endpoint of the cluster as a string in the following format: `hostname:port`. The configuration endpoint will be polled at regular intervals (see `autoDiscoverInterval` option) to detect changes to the cluster. Nodes will be automatically added/removed from the client accordingly.

When auto-discovery is disabled, same as [`memcached`](https://github.com/3rd-Eden/memcached) module - specify one or more nodes that make up your cluster.

### Options

Same as [`memcached`](https://github.com/3rd-Eden/memcached) module with the following extra options:

#### `autoDiscover`

A flag indicating whether the client should automatically discover the nodes of the cluster or not. If false, client behaviour is identical to [`memcached`](https://github.com/3rd-Eden/memcached) module and you must manually specify the nodes of the cluster when constructing the client. Defaults to `true`.

#### `autoDiscoverInterval`

The number of milliseconds between attempts to discover changes to the cluster - added/removed nodes. When auto-discovery is disabled, no polling occurs and this value is ignored. Defaults to `60000` (i.e. one minute).

#### `autoDiscoverOverridesRemove`

A flag indicating whether a dead node removed via the `remove` config option can be re-added by auto-discovery. When auto-discovery is disabled, this value is ignored. Defaults to `false`.

## API

Same as [`memcached`](https://github.com/3rd-Eden/memcached) module - except private methods are not exposed.

NOTE: When auto-discovery is enabled, calling `end()` stops the polling for changes to the cluster in addition to closing all active connections.

## Events

Same as [`memcached`](https://github.com/3rd-Eden/memcached) module with the following extra events:

### `autoDiscover`

Emitted when a change to the cluster is detected - added/removed nodes. Payload is an array of server locations for the current nodes in the cluster. When auto-discovery is disabled, this event is not emitted.

### `autoDiscoverFailure`

Emitted when a error occurs while attempting to check for changes to the cluster. Payload is an `Error` object. When auto-discovery is disabled, this event is not emitted.

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