--- Perrin Harkins <[EMAIL PROTECTED]> wrote:
> md wrote:

> 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 don't think "global" was the term I should have
used. What I mean is data that will be seen on all or
most pages by the same user...like "Hello Jim", where
"Jim" is pulled from the database when the session is
created and passed around in the session after that
(and updated in the db and session if user changes
their greeting name). 

Current page name and id are never stored in db, so
different browser windows can be on different
pages...I'm not sure if that's good or bad. However,
changes to the user name will be seen in both browser
windows since that's updated both in the session and
db.
 

> 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.

Correct. That little info I am putting in the session
corresponds directly to a single user.
 

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

Once again, I shouldn't have used the term "global".
This is the "subscriptions" info for a single
user...that's why I had thought to put this in the
session instead of pulling from the db each page call
since the data will rarely change. This info will be
displayed on every page the user visits (unless they
"turn off" this module).

 
> 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.

The session is stored in a database
(Apache::Session::MySQL), and I am using TT caching
for the templates, but I'm not sure how to cache the
non-session data. I've seen this discussed but I
definitely need more info on this. As it stands I see
two options: get data from the session or get it from
the db...how do I bring  caching into play?
 
> 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.

What about something like "default page id", which is
the page that is considered your home page? This id is
stored permanently in the db ("lasts more than the
current current browsing session") but I keep it in
the session since this also rarely changes so I don't
want 
to keep hitting the db to get it.

Thanks again...



__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

Reply via email to