Caching paginated results, purging on update - how to solve?

前端 未结 8 1057
忘掉有多难
忘掉有多难 2021-02-04 18:08

I\'ve created a forum, and we\'re implementing an apc and memcache caching solution to save the database some work.

I started implementing the cache layer with keys like

8条回答
  •  一个人的身影
    2021-02-04 18:41

    You might also want to have a look at the cost of storing the cache data, in terms of your effort and CPU cost, against how what the cache will buy you.

    If you find that 80% of your forum views are looking at the first page of threads, then you could decide to cache that page only. That would mean both cache reads and writes are much simpler to implment.

    Likewise with the list of a user's favourite threads. If this is something that each person visits rarely then cache might not improve performance too much.

提交回复
热议问题