Hiya, me again :-)

Is it possible to expire certain session data, while still keeping the
session itself in tact?


$_SESSION['AlwaysTrue'] = "True";
$_SESSION['ExpireThis'] = "10:20:00";

At 10:19:50 the session is registered.  AlwaysTrue must remain True for as
long as the session itself is true (as specified in the documentation - this
would be until the browser is closed, or after a certain amount of inactive

However, at 10:20:00 (10 seconds later), I want the ExpireThis value of the
session, to be destroyed, without having to de-register the entire session
(this would then also destroy the AlwaysTrue value...

Am I right in presuming this cannot be done, and I'll have to come up with
my own little function to do this with?  If so, how can I see at what time a
session variable was written, or would I need to register the time that the
session variable was set to the session as well?  For instance....

$_SESSION['AlwaysTrue'] = "True";
$_SESSION['ExpireThis'] = "10:20:00";
$_SESSION['ExpireThisTime'] = "10:19:50";

Then, just do a comparison, and if ExpireThisTime is past 10:20:00, then
just delete that one variable...

There's no easier / better way to do this ??

Basically, I'm needing something like this to bring down the number of
possible database queries.  I have a application which will have new
information in a database, every 75 seconds.  The queries are performed on
every single page that a user is logged in to on a site.  To make sure that
the same queries is not issued over and over on the database, I want to
implement some sort of caching where I will only need to do another query
after the database received new information (every 75 seconds).  It's all
numbers (integers), so I was thinking.... It may well work if I can save
these values to session data, and then just "refresh" the session data every
75 seconds....  The problem is, there's lots of other information saved to
the session as well, which I cannot afford to loose with a possible


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to