IPhone – Why does Safari cache old pages on iPhone even after you’ve downloaded the new page

iphonemobile-safari

This may be a problem specific to Reddit.com, but I find that if I follow a link to another site on mobile safari and hit back, that only part of the time will I see the latest copy of the page. A lot of times, I'll see a copy of the page from weeks ago that mobile Safari has cached for some reason.

For clarity this is what happens:

  1. I visit reddit on March 1st in mobile Safari, click some links, everything works.
  2. Later I visit reddit on March 3rd and I see the March 3rd homepage.
  3. I click a link to visit another site off of reddit, and then click back to go back to reddit.com
  4. I see the March 1st copy of reddit.com

Best Answer

I would imagine this has something to do with Core Data, memory warnings, or both. If Apple is using its own kit, then it is saving the cache in a Core Data store, which is, essentially, an unordered set. My theory is that when you go to a site, Safari is going to the Core Data store and grabbing the first instance of the URL in question if it exists, which can be old, new, whatever. But since I also don't think that Apple would be nearly that sloppy, I'd say that every page attempts to cache, but the amount of data required to properly cache a site is beholden to memory warnings, which you, as the user, should never, ever see, only this time the newer page simply doesn't get cached and that's why you get random older pages in view.

Okay, that was a bit technical. In short, I think Safari attempts to maintain a clean cache, but memory limitations of the device don't always allow that to happen.