Asp.net cache or manual caching

2019-04-09 14:47发布

I'm going to cache some RSS data from other websites to my server and update caches every 10 minutes. Should I use Asp.net system.web.caching or cache in database or file?

P.S: when a user requests a feed on my client application, my server downloads it from server. And in the next 10 minutes, if another user requests that feed, my server loads it from cache. There may be for than 100 feeds...

1条回答
虎瘦雄心在
2楼-- · 2019-04-09 15:42

The reason to go with custom database cache are:

  1. More control on how and when the cache expire
  2. The data are too many (more than 10Mg) *
  3. Need to keep them for too much time (days or months) *
  4. Access to the cache data on code behind (for any reason)

In your case, you only need to expire it soon, I think the data are small (less than 10Mg) and you keep it for 10 minutes, so go with asp.net cache that is faster because is lives in the core of the iis, and replays with out go to your code at all.

[*] I say that because the asp.net cache are keeped on the memory, but your custom cache are saved on database, so can live there for longer time, and can be huge.

查看更多
登录 后发表回答