poseidon-memcached

0.0.3 • Public • Published

Poseidon Memcached

Poseidon Memcached provides a promise layer around the node memcached module with the help of the Poseidon library.

Install

To get started simply run

npm install poseidon-memcached

Introduction

A basic example of performing serveral operations on a cache which would normally result in callback hell is shown below.

{DriverCache} = require '../index'
 
Driver.configure('default'{ servers: 'localhost:11212' })
cache = new Cache('default')
 
cache.add('test'{ foo: 'bar' }0)
.then ->
  console.log 'object added'
  cache.get('test')
.then (obj) ->
  console.log 'object retrieved'obj
  cache.del('test')
.then ->
  console.log 'object deleted'
  cache.add('test'{foo: 'bar returns' }0)
.then ->
  cache.add('test2'{bar: 'foo'}0)
.then ->
  console.log 'new objects added'
  cache.get(['test''test2'])
.then (objs) ->
  console.log 'objects retrieved'objs
.fail (err) ->
  console.error err
.finally ->
  console.log 'connection closed'
  cache.end()
.done()

API

All functions of the original module are available

  • get
  • gets
  • getMulti
  • add
  • set
  • del
  • cas
  • flush

License

The MIT License

Copyright(c) 2013-2014, Playlyfe Technologies, developers@playlyfe.com, http://dev.playlyfe.com/

Readme

Keywords

none

Package Sidebar

Install

npm i poseidon-memcached

Weekly Downloads

2

Version

0.0.3

License

none

Last publish

Collaborators

  • atrniv