Best Solution for Caching

后端 未结 9 698
走了就别回头了
走了就别回头了 2020-12-13 11:57

Where is the best place to implement caching in a web based app?

  • At the presentation layer (hope not)?
  • At the Business Logic Layer?
  • At the da
9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 12:24

    You should consider caching at EVERY layer.

    The best place to cache is as near to the client request as possible (so you do as little work as possible to serve the response). In web apps, yes at the presentation layer, at the business layer and the data layer.

    (Side note: If you are basically peppering your business logic code with caching logic here and there, you should really look into seperation of concerns to avoid your code becoming a big ball of mud :-) )

提交回复
热议问题