4

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...

Mahdi Ghiasi
  • 14,873
  • 19
  • 71
  • 119

1 Answers1

4

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.

Aristos
  • 66,005
  • 16
  • 114
  • 150
  • How many megabytes of data is good for Asp.net caching? (at maximum) – Mahdi Ghiasi May 31 '12 at 08:28
  • 1
    @Mahdi This is depend from what you have set on the pool memory limits. I think that the pool set this limits. When you set data on cache is not always go to the real memory, they can saved on virtual memory of the pool, that I mean are transfer to the disk. – Aristos May 31 '12 at 08:31
  • 1
    @Mahdi If you place many data on the asp.net cache you start see (using process explorer) the used memory of your pools to start grow :) If its stable (not grow any more) after some minute/hours of work, then all is ok... – Aristos May 31 '12 at 08:32
  • How to determinate how much memory is used by asp.net cache on a shared hosting server? (since it is shared hosting, I can't see the task manager) – Mahdi Ghiasi May 31 '12 at 08:39
  • You said for accessing cache from code behind, I have to use database, but I'm asking about system.Web.caching.cache , which is accessible from code behind... – Mahdi Ghiasi May 31 '12 at 08:45
  • @Mahdi ah, I was thinking that you place all the rss page on page cache. Anyway small different. You can cache the full rss page, not just the results using the outputcache – Aristos May 31 '12 at 08:46
  • and the purposes of using system.Web.caching.cache are same as page cache? – Mahdi Ghiasi May 31 '12 at 08:51