mondis
v0.0.8
Published
mongoose and redis linker
Downloads
1
Maintainers
Readme
mondis
WHAT
- We just make redis-mongoose more simple.
WHY
- Why this name?
mondis == mon(goose)(re)dis
- Why need it?
- We need read from redis first and write to redis last when you are using mongo and redis. Another words, we wrap DB with cache.
- We don't want to change exist caller and callee for DB, intrusive mood is confused and coupled.
- So, we use hooker to decouple it and provide some structs for you.
HOW
hash
//just one line, you don't need to change you original code.
/*
* @Model mongoose model
* @redis the instance of redis client
* @prefix for key to redis
* @ttl time to live for redis
* @methods ['create', 'remove', 'update', 'findById'] support for Model
*/
mondis.hash(Model, redis, prefix, ttl, methods);