# memqueue

> This library is an implementation of a queue with memcached

Latest version **1.2.0** (published 2016-01-26) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install memqueue
pnpm add memqueue
yarn add memqueue
bun add memqueue
```

## 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.2.0 |
| Published | 2016-01-26 |
| First published | 2016-01-06 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ignacio R. Galieri |
| Maintainers | nachonerd |
| Keywords | memcache, memcached, queue, cache, memory, nachonerd, memqueue |

## Links

- npm: https://www.npmjs.com/package/memqueue
- Repository: https://github.com/nachonerd/memqueue
- Issues: https://github.com/nachonerd/memqueue/issues
- npm.io page: https://npm.io/package/memqueue

## Dependencies (1)

- [memcached](https://npm.io/package/memcached.md) 2.2.x

## 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.2.0 (latest) — 2016-01-26
- 0.0.3 (beta) — 2016-01-07
- 1.1.0 — 2016-01-18
- 1.0.0 — 2016-01-17
- 0.0.2 — 2016-01-07
- 0.0.1 — 2016-01-06

## README

MemQueue
==========

[![Build Status](https://travis-ci.org/nachonerd/memqueue.svg?branch=master)](https://travis-ci.org/nachonerd/memqueue)
[![Code Climate](https://codeclimate.com/github/nachonerd/memqueue/badges/gpa.svg)](https://codeclimate.com/github/nachonerd/memqueue)
[![Test Coverage](https://codeclimate.com/github/nachonerd/memqueue/badges/coverage.svg)](https://codeclimate.com/github/nachonerd/memqueue/coverage)
[![Issue Count](https://codeclimate.com/github/nachonerd/memqueue/badges/issue_count.svg)](https://codeclimate.com/github/nachonerd/memqueue)
[![Dependencies Checker](https://david-dm.org/nachonerd/memqueue.svg)](https://david-dm.org/nachonerd/memqueue)
[![Join the chat at https://gitter.im/nachonerd/memqueue](https://badges.gitter.im/nachonerd/memqueue.svg)](https://gitter.im/nachonerd/memqueue?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![NPM](https://nodei.co/npm/memqueue.png?downloads=true&downloadRank=true)](https://nodei.co/npm/memqueue/)

## Description
This NodeJs library is an implementation of queue with memcached.

## Installation
    npm install memqueue

## Usage

```js
var MemQueue = require('memqueue');

console.info("Creating Queue...");
try {
    // create a new queue
    var queue = new MemQueue("myqueue", 'localhost:11213');
} catch (e) {
    console.error("Creation Fail: "+e.message);
}

var element = "element"+Math.floor((Math.random()*10000));

console.info("Pushing first element: "+element);
// push an element into the queue.
queue.push(element, 10, function (err) {
    if (err) {
        console.error("Push Fail: "+err);
    }
    console.info("Retrieveing last element");
    // retrieve the previously pushed object .
    queue.pop(function (err, data) {
        if (err) {
            console.error("Pop Fail: "+err);
        }
        console.info("The last element was: "+data);
        // end memcached connection.
        queue.end();
    });
});
```

<a name="method"></a>
## Methods
**Kind**: global class  
**Api**: public  
<a name="new_MemQueue_new"></a>
### new MemQueue(key, locations, options)
Constructor


| Param | Type | Description |
| --- | --- | --- |
| key | <code>Mixed</code> | Key String or Number |
| locations | <code>Mixed</code> | Array, string or object with servers |
| options | <code>Object</code> | Options |

<a name="push"></a>
## push(value, lifetime, callback) ⇒ <code>void</code>
Push

Stores a new value in Memqueue.
**Emits**: <code>push</code>  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| value | <code>Mixed</code> | Either a buffer, JSON, number or string that                            you want to store. |
| lifetime | <code>Number</code> | how long the data needs to be stored measured                            in seconds |
| callback | <code>function</code> | the callback |

<a name="pop"></a>
## pop(callback) ⇒ <code>void</code>
Pop

Retrieve Last value from memqueue.
**Emits**: <code>pop</code>, <code>empty</code> 
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| callback | <code>function</code> | the callback |

<a name="end"></a>
## end() ⇒ <code>void</code>
End

Finish memcached connection.

**Api**: public  

For more information see [Documentation](https://github.com/nachonerd/memqueue/blob/master/doc/documentation.md)

## License
The driver is released under the GPL-3.0 license. See the [LICENSE](https://github.com/nachonerd/memqueue/blob/master/LICENSE) for more information.

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