Answer the question
In order to leave comments, you need to log in
What is the best way to design caching on nodejs?
There is a project on nodejs\express, 3 layers:
1) database
2) business
3) controller
Questions:
1) In which layer should I embed check / return / cache invalidation?
2) Invalidation \ check \ return of the cache is smeared one by one \ by two \ by all layers - is this the norm?
For example, validation\return is built into the controller, and invalidation is built into the business logic\dal
3) If not the norm, then how to implement caching with minimal coupling?
Answer the question
In order to leave comments, you need to log in
The cache is embedded in the place where it is needed. It all depends on what kind of data you have. But it's still better to keep it in controllers so that less code is called. However, if you have simple controllers, then it makes sense to transfer to bl. In dbl it is worth taking out if you have an old-school application where many checks are made on storage
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question