mon-cache
mon-cache is mongoose cache to redis, memcached, or lru-cache. This utilizes the npm modules cache-client.
Initialization
lru-cache
options = store: "memory"; mongoose options;
redis
options = store: "redis" port:6379 host:"127.0.0.1" auth:"password" // optional select_db: 0 // optional, default is 0; mongoose options;
memcached
options = store: "memcached" host:"localhost:11211"; mongoose options;
additional options
options = cache: false // global option to disable caching ttl: 60 // global option to set ttl(sec), default is 60 sec debug: true // print logs for debug;
Usage
Enable cache with ttl in options. If you don't set ttl, default ttl is 60 sec.
MyModel ;
or
query // can explicit enable (or disable) cachingquery // enable caching with 10 sec ttlquery // enable caching with 10 sec ttl
Contact
- email: asterisk@makeus.com