[英]How to implement caching mechanism in Sequelize ORM npm — node.js
I am writing REST APIs in Node.js with Sequelize as ORM npm, to manage my data models. 我正在使用Sequelize作为ORM npm在Node.js中编写REST API来管理我的数据模型。
I am concerned about my APIs performance because there are many clients, will be using same API, so I want to implement caching mechanism in Sequelize ORM. 我担心我的API性能,因为有很多客户端,将使用相同的API,所以我想在Sequelize ORM中实现缓存机制。
Would it be possible with Sequelize ORM ? Sequelize ORM会有可能吗? if yes How ?
如果是的如何?
You can use caching layers like Redis or Memcached to store your results, if you have big ammounts of data. 如果您有大量数据,可以使用Redis或Memcached等缓存层来存储结果。 Here is a comparison between these two Memcached vs. Redis?
这是两个Memcached与Redis之间的比较? .
。 Also there is
sequelize-redis-cache
npm package you can use https://github.com/rfink/sequelize-redis-cache 还有
sequelize-redis-cache
npm包你可以使用https://github.com/rfink/sequelize-redis-cache
If you are using Sequelize 4, check out that module: 如果您使用的是Sequelize 4,请查看该模块:
https://github.com/idangozlan/sequelize-redis https://github.com/idangozlan/sequelize-redis
It's a full solution for caching + invalidating cache easily, and as much as I know it's the only Sequelize 4 caching module (right now). 它是一个完整的缓存+缓存无效缓存的解决方案,而且据我所知它是唯一的Sequelize 4缓存模块(现在)。
Disclaimer: I'm the author of that module and I'm using that on production for daily traffic of 1m unique users. 免责声明:我是该模块的作者,我正在使用它来生产100万独立用户的日常流量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.