News for hackers. Stuff that matters.
Re:Caching AJAX calls with local storage by robinkomiwes on Friday July 20, 2012 @08:16AM (#4270386)
I'm one of the guys behind this plugin. In our case built-in browsers cache mechanisms were a no go because we needed to have a programmatic control over our cache. Our app is heavily powered by realtime notifications from the server, and we needed a way to invalidate the cache when some events occurs.

About 'isCacheValid' setting the cache key, you're right, it should have been done in the success callback. The gist is going to be updated soon with your feedback.

Re:Caching AJAX calls with local storage by untog on Friday July 20, 2012 @09:12AM (#4270546)
Couldn't you use just an extra query string parameter when you want to force a refresh? Like, ?v=12312312353. It's a little hackish I'll grant you, but so is caching HTTP in LocalStorage.
Re:Caching AJAX calls with local storage by pohl on Friday July 20, 2012 @10:14AM (#4270875)
This won't actually cause anything to be evicted from the cache. It just adds a new cache entry with a new key. This is poor resource management, and removes some of the appeal of going out of your way to reuse the browser's cache mechanism.
Re:Caching AJAX calls with local storage by untog on Friday July 20, 2012 @10:56AM (#4271053)
Sure, but the HTTP cache is managed by the browser. Unless you are pulling down mammoth amounts of data, cache management is unlikely to be a concern for you.
Re:Caching AJAX calls with local storage by d0ugal on Friday July 20, 2012 @11:44AM (#4271271)
Browsers cache many things each time you go to a website - all the html and assets (js/css/images) will be potentially cached (depending on headers). Often you will not go to that website again. They are optimised for this.
Re:Caching AJAX calls with local storage by d0ugal on Friday July 20, 2012 @09:15AM (#4270562)
This is better.