You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Garrison Hoffman <ga...@codefix.net> on 2005/09/18 07:25:10 UTC
Apache::Session cleanup
I'm using mod_perl2 + Apache::Session::MySQL and I'm wondering what to
do with stale sessions. Does Apache::Session do any cleanup or do I
need to explicitly tied(%session)->delete; ?
I'm storing session IDs in cookies for 60 days, so I'd like to limit
sessions similarly. I could certainly run a cron for this, but is there
a better way?
--
__________________________________________________________________
Garrison Hoffman Codefix Consulting 1.718.210.3445
garrison@codefix.net http://codefix.net/ 1.866.456.0584
Re: Apache::Session cleanup
Posted by Garrison Hoffman <ga...@codefix.net>.
___cliff rayman___ wrote:
> I believe that deleting them via the cron is the standard method.
This makes sense, though I had hoped for something more perlish.
> I actual use a more complex technique that looks into the session to
> decide if it is a session worth saving, such as it contains an affiliate
> referral, or cart data, etc..
>
I posted the same question on perlmonks and got some sample code for
reading the frozen/base64 encoded hash used by Apache::Session::DBI
http://perlmonks.com/?node_id=492983
--
__________________________________________________________________
Garrison Hoffman Codefix Consulting 1.718.210.3445
garrison@codefix.net http://codefix.net/ 1.866.456.0584
Re: Apache::Session cleanup
Posted by ___cliff rayman___ <cl...@rayman.com>.
Garrison Hoffman wrote:
>I'm storing session IDs in cookies for 60 days, so I'd like to limit
>sessions similarly. I could certainly run a cron for this, but is there
>a better way?
>
>
I believe that deleting them via the cron is the standard method. Test
out the following (by changing rm to ls -l) before letting it loose on
your system.:
find /path/to/session/dir /path/to/lock/dir -type -f -mtime +60 -exec
rm {} \;
I actual use a more complex technique that looks into the session to
decide if it is a session worth saving, such as it contains an affiliate
referral, or cart data, etc..
--
_____cliff_rayman_____________________________________
Business Consulting and Turnaround Management
[web] http://www.rayman.com/
[web] http://all-clear-turnaround-management.com/
[eml] cliff@rayman.com
[phn] 888-736-3802 x701
[fax] 818-743-7404
______________________________________________________