Implementing Model-level caching

前端 未结 8 1504
孤城傲影
孤城傲影 2021-01-31 00:28

I was posting some comments in a related question about MVC caching and some questions about actual implementation came up. How does one implement a Model-level cache that works

8条回答
  •  抹茶落季
    2021-01-31 00:56

    I would recommend that you look here for a comprehensive look at caching in ORM's including the problems and solutions that can be applied.

    When dealing with caching data in an ORM, you generally have the following 3 problems to solve:

    1. Many ORM implementations store either the database resource or a non-serializable result set or both in the actual ORM objects. Since caching requires that all objects be serialized, this puts a serious road block in our way.
    2. How do you track one set of data versus another in the cache?
    3. How do you notify the cache that a particular data set has changed?

提交回复
热议问题