1
votes

In our AEM instance we are getting data from an external system, per user this data is the same during his session. So it make sense to store this data in their session / cache or something like that. With another CMS we used before we always stored such data in the session. Is that also the right solution here for AEM 6.1 or are there better alternatives?

Call 1 that needs to be stored: Size in bytes: 34597 Call 2 that needs to be stored: Size in bytes: 2201

Thanks for your response.

1

1 Answers

2
votes

I can think of 3 solutions..

  1. Get the data from the Session into a java class, create a pojo, and build the object of the pojo with the data in the session. Then serialize this pojo and save it in your browser's cookie. While retrieving it, you can de-serialize it and use it on your form or in your java code. Have to see how big of the object it becomes with the data that comes. Cookies have a 4KB limit on size.

  2. If you can use Angular(or JQuery), you can save this session to "HTML5 LocalStorage" and retrieve it to manipulate and display on the form or send to a webservice. The advantage is that the LocalStorage has bigger capacity(5MB) and most modern browsers support it. The drawback is that you cannot access this locastorage from Java (server-side). I have attached a screenshot with browser storage options that show up when you press "Ctrl + i" on Chrome. enter image description here

  3. Save the session data to AEM repository and manage it from there (add data, remove, read etc.)

I have implemented each of the above and let me know if you need examples.