We use sequelize with models for our database connection. As it stands, it can take a few seconds to import the models when creating a Sequelize object. We're wondering if we should cache this object at start up to optimize the execution. Is there a better way to get the initialized sequelize object?
If not, which cache library would you recommend? I've tried cache-manager and node-cache but the object seems too big for them as I kept getting errors. We currently use memory-cache to cache the object.
CodePudding user response:
You should have one instance of sequelize for the whole app in a simple use case.
I think you're instantiating it for each request and for that reason it's slower