poseidon-memcached

A future wrapper around the Node Memcached driver using Poseidon.

Poseidon Memcached

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

To get started simply run

npm install poseidon-memcached

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()

All functions of the original module are available

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

The MIT License

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