[cgiapp] Understanding sessions

Mark Fuller azfuller at gmail.com
Sun Feb 24 11:24:50 EST 2008


>  1. how can those unnecessary sessions be deleted?

If you're on a unix system you can use the "find" command with the
"-mtime" option to find files in a directory older than a certain time
(-name to limit it to a certain pattern of filename). If you're not on
unix you could write a simple Perl script to do the same thing,
looping through all the filenames in a directory, using one of the -x
built-in functions. It would be simple. Pass it a path on the command
line, out put filenames in the stdout that could be used in a shell
loop to remove the files.

Usually "store" cleanup is something done outside the session tool.
You're using files for the session store. I use cache::cache[1].
Others use postgres. I think it's expected everyone does their own
cleanup of stores for sessions that haven't been visited after some
reasonable amount of time after the expiration time.

I don't use cgi::session. Cees or Mark S. would have to explain it
more specifically. I like cache::cache[1] because it has a method to
purge expired cookies. I can use a scheduled script which does nothing
more than instantiate the cache and invoke the method. I think you'd
have to create a driver to use it with c::s. I understand c::c is
being redone as chi..pm (search CPAN for it).

[1] http://search.cpan.org/~dclinton/Cache-Cache-1.05/lib/Cache/Cache.pm

Mark


More information about the cgiapp mailing list