title: Rails.cache and un-dumpable (Marshal) structures: how to cache? (on the example flickraw-response)
body: <p>i want to Rails.cache a flickraw response (this is applicable to other un-dumpable structures as well) with memcached as follows:</p>
  
  <pre><code>@flickr = Rails.cache.fetch('flickr_sets', :expires_in =&gt; 1) { flickr.photos.getRecent }
  </code></pre>
  
  <p>the obvious error is</p>
  
  <pre><code>TypeError: singleton can't be dumped
  </code></pre>
  
  <p>i read a good post on that problem by zilkey, who suggests building a new dump method for that case.</p>
  
  <p><a href="http://zilkey.com/2008/7/5/rails-cache-memcached-development-mode-and-offline-cache-invalidation" rel="nofollow">http://zilkey.com/2008/7/5/rails-cache-memcached-development-mode-and-offline-cache-invalidation</a></p>
  
  <p>my questions are: what would be the right approach to cache that kind of objects? should i write my own dump method? wouldn't it be possible to save the object in the cache with flickr.photos.getRecent.to_s as a String and then somehow reload it? any ideas?</p>