Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So as to optimize an application, I must implement data caching: not to recompute some data - those heavy on cpu but that don't change often.

When playing with the idea, I imagined something like the way win32/MFC manages the windows screen i.e.:

  • While a part is valid, it is not repainted.
  • When a rectangle or a region is invalidated, this part is repainted during the next painting session - launched by the OS.

I was imagining a way to validate and invalidate my cached value, so as to recompute only what is necessary when it is necessary.

Then I read this wikipedia page about Cache Algorithms, and none of the listed algorithm was using the technique I explained above. So I feel ill at ease, and I need to read some work about caching.

Do you know of some resources that I could rely on before I start implementing my own cache process ?

share|cite|improve this question
Are you interested in something like a programming tutorial or best practice, or do you want sciencey answers? – Raphael Jan 28 '13 at 10:11
@Raphael I have started to read the article that Reza's answer is pointing to. It's pretty much what I expected/wanted: Theoretical critiques and point of view over real life application of cache algorithms. However, if you have other ressources that you might find helpful, don't hesitate: I love having several learning and knowledge sources. – Stephane Rolland Jan 28 '13 at 10:16
I don't have references handy; it's just that in the first case, your question would be offtopic here. :) – Raphael Jan 28 '13 at 10:17
up vote 3 down vote accepted

The best strategy to find the best suitable algorithms for caching is to read survey papers in this area. I recommend the paper A survey of Web cache replacement strategies by Podlipnig and Böszörmenyi (2003) which reviews many general techniques for caching.

share|cite|improve this answer

The best overall view on optimization I've seen is Bentley's "Writing efficient programs" (sadly out of print), the medular part of its rules are in his "Programming pearls". For analysis of the algorithms I'd dig into Cormen et al "Introduction to Algorithms" (don't let the "introduction" fool you, it is more an encyclopaedia).

share|cite|improve this answer
Aren't those a bit too general? – Raphael Jan 28 '13 at 10:18
@Raphael, can't give a specific answer to a general question... – vonbrand Jan 28 '13 at 10:29
Well, the question is focused on caching (if very general otherwise), so general program optimisation references seem to be too general. YMMV. – Raphael Jan 28 '13 at 10:31
It asked specifically on optimizing performance by caching... and that may well be the wrong strategy. – vonbrand Jan 28 '13 at 15:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.