News for hackers. Stuff that matters.
Re:Basket.js: A simple script loader that caches scripts wit... by SMrF on Friday March 02, 2012 @12:39PM (#3657478)
I feel like using localStorage to cache stuff that could be handled by http caching is probably a mistake. I'm in the process of caching a bunch of our application in localStorage because a quirk in our client-side architecture means I need to know if something is cached before making an asynch request for content, (which you can't do with the standard http cache). That means I'm reinventing a cache invalidation scheme -- which we all know is hard, right? Plus the space allocated for localStorage is pretty small, so I have to have a way to prioritize the cache and bump out old stuff to make way for new. It's all rather convoluted.

IMHO, edge cases aside, most people shouldn't do this.

Re:Basket.js: A simple script loader that caches scripts wit... by shantanubala on Friday March 02, 2012 @04:19PM (#3658429)
Caching assets in localStorage definitely isn't a "best practice," and seems like something that should only be done when necessary.

One of the best uses for localStorage though, is caching client-side templates. If you're building an app that's got a ton of different models and templates for each one, it makes your application a lot more efficient to lazy-load them as needed and cache them in localStorage for later use with versioning and cache invalidation.