2

I've simplified this example a lot, but the theory is there.

I have a table which contains content for a page - there might be 3 or 4 rows per page.

Every time a page loads, the database is queried and the content loads. This is fine generally, but on busy sites this can hit the database quite a lot.

I'm looking for some kind of "caching" solution - that ideally doesn't use much in the way of memory (ideally it'll be file system based).

Any ideas?

Paul
  • 9,409
  • 13
  • 64
  • 113

1 Answers1

1

Anything wrong with ASP.NET's built in Cache?

Also might want to check out How to implement a custom cache provider with ASP.NET MVC

As a final suggestion, you may want to look into building a filesystem-based cache using the System.Caching classes documented here. From a brief perusal, it looks like you'd probably want to inherit from ObjectCache.

Community
  • 1
  • 1
Chris Shain
  • 50,833
  • 6
  • 93
  • 125
  • Fundamentally, no - it's just consumes quite a lot of memory, if there's a way to make it file system based... – Paul Feb 04 '12 at 19:49
  • The maximum amount of memory that it uses can be configured, if that helps: http://msdn.microsoft.com/en-us/library/system.web.configuration.cachesection.percentagephysicalmemoryusedlimit.aspx – Chris Shain Feb 04 '12 at 19:54
  • But then if it peaks at the maximum amount of memory...where is it being stored? – Paul Feb 04 '12 at 19:56
  • It isn't. It will discard items from the cache and free up memory once the cache grows too large. – Chris Shain Feb 04 '12 at 20:00
  • I think that would be a problem for us as the cache may be huge, and so it's going to be constantly re-loading items in and out of the cache... – Paul Feb 04 '12 at 20:05