title: Save memcache data to a file or a database
body: <p>We're running a website which performs financial modeling and it takes a while for <code>memcache</code> to build its cache. For instance, after 1 week the number of hits is only at <code>48%</code> and the cache used is <code>2GB</code> (out of <code>5GB</code> allocated). Since we don't want to loose that cache should the server crash or need to be restarted, we would like to save it somewhere.</p>
  
  <p><strong>Q: What are the best options for storing the content of the <code>memcache</code> cache somewhere permanent (and restoring that content)?</strong></p>
  
  <p>So far we haven't seen memcache reach the point whereby <code>%</code> of hits doesn't improve. We know we quickly get to <code>30%</code> hits with <code>300MB</code> of data, which corresponds to caching of shared content. Afterwards, objects become much bigger and are created less frequently. By looking at our munin graphs, I would say we could reach our best <code>%</code> of hits within 2 to 3 months. I really think we have a case for saving our memcache data.</p>
  
  <p><img src="https://i.stack.imgur.com/pzVNF.png" alt="enter image description here"></p>
  
  <p>FYI I'm not adding the graph showing the <code>%</code> of hits/misses because it evolves so slowly that it's not really readable.</p>