Session handling - How to add page values to user session or request?

How can we add page values or any other value from one page to another in session?  I have tried below approach as a workaround but it can’t be used as solution for the issue as It won’t handle all scenarios. Creating Non persistable object → In this method I created an empty object of non persistable entity on click of button and gave fields on next page and on click of save called a microflow and inside microflow showed a page. Since in this approach I was able to pass the object to the next page (as it was available as variable in the flow) – values were available on that page.  Issues that I faced with this approach  :  If I traverse to any other page the values won’t be available. Not sure when garbage collection will be done for the non persistable object or entity Can’t pass the entity variable from one microflow to other    
1 answers

You might want to do some basic learning paths. You can use a (non) persistent object as helper entity. You can pass that entity from one page to the other by passing this object as parameter in the microflow to open the next page. Do note that non persistent objects can also be attached to the user session and thus retrieved in a microflow by retrieving the current user and then retrieve the attached objects again.

Garbage collection will take place when the object is no longer in use. That's why attaching it to the user session it will not be garbage collected untill the user logs out.