title: What is caching?
body: <p>I'm constantly hearing about person y had performance issue x which they solved through caching.</p>
  <p>Or, how doing x,y,z in your programs code can hurt your caching ability.</p>
  <p>Even in one of the latest podcasts, Jeff Atwood talks about how they cache certain values for speedy retrieval.</p>
  <p>There seems to be some ambiguity in the terms &quot;cache&quot; and &quot;caching&quot; and it has led me to be confused about it's meaning in different cases.  Whether you are referring to application or database caching, cpu, etc and what that means.</p>
  <p><strong>What is caching and what are the different types?</strong></p>
  <blockquote>
  <p>From context I can get a sense of it,
  to store an oft retrieved value into
  main memory and have quicklook up
  access to it.  However, what is it
  <em>really</em>?</p>
  <p>This word seems to be used in a lot of different contexts with slightly different meaning (cpu, database, application, etc) and I'm really looking to clear it up.</p>
  </blockquote>
  <p><strong>Is there a distinction between how caching works in your applications vs your database caching?</strong></p>
  <blockquote>
  <p>When someone says that they found a
  piece of code that would hurt caching
  and after they fixed it, it improved
  the speed of their app, what are they
  talking about?</p>
  <p>Is the program's caching something
  that is done automatically?  How do
  you allow values to be cached in your
  programs?  I've often read users on
  this site say that they cached a value
  in their application, I sit here and
  wonder what they mean.</p>
  <p>Also, what does it really mean when
  someone talks about database
  caching?  Is this simply a feature
  they turn on in their database?  Do
  you have to explicitly cache values or
  does the database  pick which ones to
  cache for you?</p>
  </blockquote>
  <p><strong>How do I begin caching items myself to improve performance?</strong></p>
  <blockquote>
  <p>Can you give me some examples of how I can begin caching values in my <strong>applications</strong>?  Or again, is this something that is already done, under the hood and I simply have to write my code in a particular way to allow &quot;caching&quot;?</p>
  <p>What about database caching, how do I begin that?  I've heard about things like memcache.  Is this type of utility required to cache in databases?</p>
  </blockquote>
  <p>I'm looking to get a good distinction between caching in applications vs databases, how they are used and how it is implemented in both cases.</p>