Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does sequelize cache common requests

So my question is very simple. If I will perform the same query a lot of time per second/minutes (like User.find(test_user_id)) it will send request to database each time or it's just cache query result somehow?

like image 866
Ph0en1x Avatar asked Feb 15 '14 22:02

Ph0en1x


1 Answers

In your example, User.find(test_user_id), User is the database table model you are querying and .find is your data retrieval method. From the sequelize site the finder method is defined as follows:

"Finder methods are designed to get data from the database."

If you call User.find(...) you will be querying your database for each query request.

like image 96
Val Avatar answered Oct 28 '22 02:10

Val