Skip to content

serby/uber-cache-mongodb

Repository files navigation

mongodb backed implementation of uber-cache

See http://github.com/serby/uber-cache for more details

build status

Installation

  npm install uber-cache-mongodb

Usage

var Db = require('mongodb').Db
  , Server = require('mongodb').Server
  , server = new Server('localhost', 27017, { 'auto_reconnect': true })
  , db = new Db('uber-cache-db', server, { fsync: true, w: 1 })
  , UberCache = require('uber-cache-mongodb')

db.open(function(error, connection) {
  var cache = new UberCache(connection)
  cache.set('the key', 'the value', function() {
    cache.get('the key', function(error, value) {
      console.log(value)
      db.close()
    })
  })
})

Credits

Paul Serby follow me on twitter

Licence

Licenced under the New BSD License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published