You can save any information you like in $_SESSION . I believe that it can be up to 128 MB - the limit is determined by memory_limit , which is 128 MB by default. You can change that.
However, as a rule, I would like to store information that is relevant and / or less expensive than a database query - Put another way as little as possible .
This will not doubt the wide range of uses, but often sessions contain things such as:
- Username
- Full Screen Names
- E-mail address
- Identifier (user or other)
- Access rights
- Groups of users
- Hash
- Form input errors (temporarily to highlight form errors)
Storage of large blocks of data / information is not recommended, although for speed / scale reasons.
If your site / platform needs to be scaled at a later date, in the right place, you will be better off looking through pass-through caching or similar for frequently used / required data (for example, Memcached ) and store the vast majority of data in your database - where it should be.
Hope this helps.
source share