Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
egg-mongoose-cache
Advanced tools
Egg's cache plugin based on egg-mongoose and egg-redis for egg framwork
$ npm i egg-mongoose-cache --save
egg-mongoose-cache ver | egg 2.x | egg-mongoose 3.2.x |
---|---|---|
1.x | 😁 | 😁 |
0.x | ❌ | ❌ |
// {app_root}/config/plugin.js
exports.mongooseCache = {
enable: true,
package: 'egg-mongoose-cache',
};
see config/config.default.js for more detail.
egg-redis Single Client:
exports.mongooseCache = {
ttl: 600,
keyPrefix: 'mc:',
}
egg-redis Multi Clients:
exports.mongooseCache = {
instanceName: 'cache',
ttl: 300,
keyPrefix: 'mc:',
}
In controller or service, you can use find/findOne/aggregate to cache data to redis.
Use FindOne/populate, cache 60 second:
let data = await ctx.model.user.findOne({ 'username': 'user1' }).populate('userinfo').cache(60);
Use Find, cache 600 second:
let data = await ctx.model.user.find({}).limit(10).skip(5).cache();
Use Aggregate, cache 60 second and user custom key:
let data = await ctx.model.user.aggregate(myPipelines).cache(60,'myKey');
Please open an issue egg-mongoose-cache issues.
FAQs
cache module for egg-mongoose
The npm package egg-mongoose-cache receives a total of 2 weekly downloads. As such, egg-mongoose-cache popularity was classified as not popular.
We found that egg-mongoose-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.