Search code examples
htmlgwtlocal-storagegxt

GWT memory buffer compared to session storage


Working with GWT/GXT i like to speed-up my App with 'local-caching'. I red about HTML5 session storage, but i was wondering why i shouldn't just use a memory buffer (a big hashmap with all the incoming data).

Whats the pitfall with the memory buffer compared to session storage?


Solution

  • Just as what Thomas Broyer detailed in his comment, the pitfall for using a Map or any similar kind of data structure to save data is that all your data will be lost on page refresh.

    If this is not a concern for your given scenario, I don't see any issue using Map/List or anything like that.

    In the Errai framework we use a lot of @ApplicationScoped beans to hold data across the whole application, for example the currently logged in user, the latest loaded data from server etc.