Since this thread seems to be getting little traction, I'll bite.
Let me see if I understand the requirements, because numbers two and three just seem, well, weird.
- Requirement 1 says "Save the data for 90 days". Clear enough.
- Requirement 2 says "If the user clears the browser cache, the data should be discarded." Why does clearing the cache need to clear the data? Does it actually need to do so? Or are you saying "this is a problem I need to overcome. If the user clears the cache, their data is lost. I need to save the data in such a case." The requirement as originally stated sounds more like a problem statement that a requirement. Please clarify.
- Requirement 3 says "The user can only access the data from one device." Again, is this the "requirement" or more of a problem statement?
So, depending on the data involved, cookies are a less-than-optimal way of storing this kind of data. A user can refuse to allow cookies, so that breaks your design immediately. Depending on the amount of data, a browser's cookie mechanism may limit the amount of data stored in the cookie. You'd also be coding to the least common denominator browser to make this solution work, as each browser's cookie implementation varies.
If you are dead-set on pursuing this approach, there really isn't much code you need if you are using SiteStudio template pages. There are already <$getCookie$> and <$setCookie$> IDOC functions. You can get that from the scripting reference.
A better way though, in my opinion, is to look at how Content Server creates the pne_portal.hda file that is used to store user preferences. That's actually a pretty solid way to save the data, as you get out of cookie limitations, plus the data is shareable across devices. I don't have any sample code that I can access at the moment, but if you look in the code for "editTopics", you should be able to get an idea of what's happening.