Is there a way to implement an app-wide in-memory cache for a HTML5 web application?
Is there a HTML5 feature to have in-memory cache of data? I’m not talking about the browser cache which merely stores server responses. I need caching of more efficient objects.
One possibility I can think of is to implement a global singleton JavaScript object that will be created once for the lifetime of the app, so that it can handle caching and retrieving data. If this is the only way, how can such a singleton object be created?
Here is a really simply singleton without too much enforcement. It could be done on a really protected way, where the Cache constructor isn’t really accessible to the outer world, tell me if interested.
Now you call as you’d expect: