md wrote:
> Currently I'm putting very little in the session

Good.  You should put in as little as possible.

> what I am putting in the session is more "global" in
> nature...greeting, current page number, current page
> name...

That doesn't sound very global to me.  What happens when users open 
multiple browser windows on your site?  Doesn't it screw up the "current 
page" data?

> I'm
> pulling a lot of info from the database and I wonder
> if my design is sound.

Optimizing database fetches or caching data is independent of the 
session issue.  Nothing that is relevant to more than one user should 
ever go in the session.

> Now I need to add global "modules" to the page which
> will show user info like which pages they have created
> and which features are being emailed to the user.
> These modules will display on every page unless the
> user turns them off.

That sounds like a "user" or "subscriptions" object to me, not session data.

> It seems that since this info
> wouldn't change very often that I should put the data
> in the session...

No, that's caching.  Don't use the session for caching, use a cache for 
it.  They're not the same.  A session is often stored in a database so 
that it can be reliable.  A cache is usually stored on the file system 
so it can be fast.

Things like the login status of this session, and the user ID that is 
associated with it go in the session.  Status of a particular page has 
to be passed in query args or hidden fields, to avoid problems with 
multiple browser windows.  Data that applies to multiple users or lasts 
more than the current browsing session never goes in the session.

- Perrin

Reply via email to