I have user information which I need to use in different places on the web application, stuff such as email, name, user settings, and so on and so forth.
The question I want to ask, is it wise to do so, or is it a huge waste of memory? and if it's not wise to do so, are there 开发者_如何学运维other things which I can do which could solve my problem?
Thank you.
Store anything you need there, as long as you remember that it is kept on the server and will be retrieved for each page load in the session.
It's usually considered bad practice to store too much in the session as the house-keeping that the server has to perform starts to add up when you've got many users. You only really need to store a user id in the session then you can pull everything else out of a database.
Why not using Cookies??
精彩评论