What is meta? ×

I've always been impressed with StackOverflow's cache: it seems to strike a perfect balance between snappiness and sensibility.

Which of the half-dozen* cache invalidation strategies promoted by Microsoft does StackOverflow use? I personally would love to hear a 2-3 sentence summary from a member of the team, and I imagine it would be instructive to a lot of people building sites on the MSFT stack.

*Okay, maybe I exaggerate.

share|improve this question
This question may be relevant to the question here: meta.stackexchange.com/questions/110320/… –  Norman H Dec 16 '11 at 17:15

2 Answers 2

up vote 10 down vote accepted

One thing we do

  • Key: the hash of the SQL, combined with a string name
  • Value: the List<int> of ID numbers returned by the search

There's your key-value pair, and that is placed in HttpRuntime.Cache

Views take those list of IDs and hydrate the rest of the row / table values depending on what page they are on, etc.

We do both sliding cache (re-validated every time it is used) or fixed time expiration, depending on what is needed.

share|improve this answer
I thought you were using LINQ... are you getting the generated SQL somehow? –  WildJoe Jul 30 '09 at 7:26
So, no explicit invalidation? Just expiration? I thought for sure the site used some kind of invalidation, but I guess I've just gotten lucky. Anyways, many thanks for the reply. –  Portman Aug 6 '09 at 3:35
@WildJoe, you can get the SQL from your DataContext. msdn.microsoft.com/en-us/library/… –  Portman Aug 6 '09 at 3:36

I would assume it uses one of the cache validation strategies that the MVC framework uses. Although this site was built when the MVC was in beta, so they may have their own solution.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .