title: NSURLConnection on iOS doesn't try to cache objects larger than 50KB
body: <p>Despite Apple's documentation <a href="https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html" rel="noreferrer">indicating otherwise</a>, <code>NSURLCache</code> on iOS doesn't do any disk (flash) caching at all. You can subclass <code>NSURLCache</code> to change the behaviour of the fetch and store operations to use the disk (like <a href="https://github.com/rs/SDURLCache" rel="noreferrer"><code>SDURLCache</code></a> does), but due to the following severe limitations of how the cache is used and implemented, this doesn't work as well as you'd expect:</p>
  
  <ul>
  <li><code>NSURLConnection</code> doesn't even call <code>storeCachedResponse:forRequest:</code> for files over about 50KB (>= 52428 bytes, to be exact). This makes subclassing <code>NSURLCache</code> pointless for our use (200KB images), because it won't even get to the cache. As a result, we have to add caching manually at a level above <code>NSURLConnection</code>.</li>
  <li>Even when one calls the NSURLCache's built-in <code>storeCachedResponse:forRequest:</code> manually, it only stores the response in memory if it's less than about 180KB. I tested this by calling storeCachedResponse manually and seeing that the before/after <code>currentMemoryUsage</code> didn't change for data lengths above about 180KB. So we have to write our own LRU memory caching too.</li>
  </ul>
  
  <p>Has anyone else noticed these issues? Or is there something I'm missing?</p>
  
  <p>FYI, I'm running iOS 4.3 in the simulator and on an iPad 2.</p>