I'm working with caching and persistence for the first time.
I have a user object that handles all my user data. Persisting this from page to page I'm planning on using a cookie with a token that then returns the user-object from the cache.
What's the best way to implement this. The two ideas/solutions that appear to me are:
1) Cache a Dictionary where the token is the key and the user object is the value. Pull the token from the cookie and retrieve the user-value.
2) Cache each user value independently with the token as the cache id.
I'm sure there are lots of other ways to do this. Let me know which of the above is best practice, or suggest an alternative and explain why.
Thanks!
(Most of my experience is with Windows development, almost none of that for the web so I'm trying to figure out a few things.)
language: c#.Net (3.5)