cayasso / mongoose-cachebox Goto Github PK
View Code? Open in Web Editor NEWCache mongoose queries in memory, redis or use your own driver
Cache mongoose queries in memory, redis or use your own driver
From the looks of it, this only covers find() queries. Could this be expanded to also cover findOne() and the Model.prototype.findById functions? That was repeat requests for the same data can be cached as well.
In Mongoose 3.8.x, it appears that Query::bind()
is not being called automatically at the time of query creation. As a result, when I make a call to query.cache()
, no Cache
object has been created and assigned to query._cache
.
I've enabled cache by default:
var options = {
cache: true, // start caching
ttl: 30 // 30 seconds
};
// adding mongoose cachebox
mongooseCachebox(mongoose, options);
Do I still need to specify .cache()
, like in this query:
Person
.find({ active: true })
.exec(function (err, docs) {
/* .... */
});
will this be a cached query?
Hi,
Maybe it's just me but doesn't it seem obvious to add storing the cache in MongoDB also?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.