Skip to content

Vertafore/memcached-q

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memcached-q

A wrapper for the npm "memcached" package which converts the asynchronous methods to a promise-based API, using npm "q" package's promise implementation.

Installation

npm install memcached-q --save

Usage

var MemcacheQ = require('memcached-q');

var cache = new MemcacheQ(serverLocations, options);

cache.set('foo', 'bar', 20)
    .catch(e => console.log('An error occurred: ', e));

// Later on:

cache.get('foo')
    .then(val => {
        if (val) {
            return val;
        } else {
            return expensiveFetchWithPromiseAPI();
        }
    })
    .then(val => {
        // Do something with result.
    });

API Reference:

See the memcached API docs for more details. The API is identical except where node-style async functions are concerned.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published