I am writing REST APIs in Node.js with Sequelize as ORM npm, to manage my data models.
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.
Would it be possible with Sequelize ORM ? if yes How ?
Sequelize is an Object Relational Mapper for Node. js. Sequelize lets us connect to a database and perform operations without writing raw SQL queries. It abstracts SQL queries and makes it easier to interact with database models as objects.
You can use caching layers like Redis or Memcached to store your results, if you have big ammounts of data. Here is a comparison between these two Memcached vs. Redis?.
Also there is sequelize-redis-cache
npm package you can use https://github.com/rfink/sequelize-redis-cache
If you are using Sequelize 4, check out that module:
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).
Disclaimer: I'm the author of that module and I'm using that on production for daily traffic of 1m unique users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With