Skip to content

Instantly share code, notes, and snippets.

@coreyd303
Last active August 29, 2015 14:05
Show Gist options
  • Save coreyd303/747972384b0694652795 to your computer and use it in GitHub Desktop.
Save coreyd303/747972384b0694652795 to your computer and use it in GitHub Desktop.
Storing State in Sessions
1. What's the difference between a cookie and a session?
A cookie is a string of data that is set on response to be stored on client. It works as an encrypted data package used for managing communication.
A session is more like an object that exists on the request
2. What's serialization and how does it come into play with cookies?
Object --> string (Cookies serialize data)
3. Can a cookie be shared by more than one user? How/why?
Yes, if both users are on the same client. (But really shouldn't be)
4. What would it mean to store a shopping cart in a cookie?
It would mean that the shopping cart could be highjacked, but it would be much faster, though you lose cross device access
5. What advantages/disadvantages are there between cookie-stored carts and
database-stored carts?
Cookie is fast, but limited, database is slower but protected
Cookie stored carts are not permanent...
Cookie stored carts are used only by server...?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment