Skip to content

Instantly share code, notes, and snippets.

@dg3feiko
Created April 27, 2015 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dg3feiko/d99df91913076f63667c to your computer and use it in GitHub Desktop.
Save dg3feiko/d99df91913076f63667c to your computer and use it in GitHub Desktop.
var dbs = require('dbs');
//registeration
dbs.newStore("Address",{
"config"
{
},
db_engine:"http://aws.us-1.dynomodb.com/postmen/postmen_address"
validator:
cache:null
})
var dbstore = dbs.newStore({
address: {}.
user: {}
})
dbs.newStore("User",{
db_engine:"http://aws.us-1.dynomodb.com/postmen/postmen_user"
validator:
cache:
})
====================================
var myMW = fucntion(req, resp, next)
{
var dynamodb_client = dbs.store("User").db_engine;
}
===================
var map = {};
DBS.modules.export = {
getStore:function(key)
{
return map.key;
},
setStore: function(key, params)
{
map.key = new Store(key, params);
}
}
Store.prototype.put = function(params)
{
//validate input
//save to dynamodb
// cache it to redis
}
Store.prototype.findById = function(params)
{
//load it from cache
//if cache hit, return result
//else load it from db and then insert to cache
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment