Caching is an attempt to trade memory for speed.
Caching only works if there is a hierarchy of memory, with those closer to the processor being faster and smaller and those further away being slower and larger.
Caching works on the assumption that things which I have used I am likely to use again, and so puts the most commonly used items in the fastest memory. (There has been a variety of research on cache locality tendencies attempting to verify when this is true or not, and if so, under what conditions and by how much.)
See also
Shameless plug
If you're using PHP and want to cache something from another server, consider using my PHP class CacheIt.
