18 Oct 2004 15:16:18 UTC
- Distribution: CGI-MxScreen
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (7 / 28 / 7)
- KwaliteeBus factor: 0
- % Coverage
- License: unknown
- Activity24 month
- Download (73.9KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
CGI::MxScreen::Session::Medium::File - File session medium
# Not meant to be used directly
This saves the session within a file on the server side. Session files are created under a set of directories, to avoid having directories with two many files in them, which is inefficient on most filesystems (reiserfs excepted). An MD5 hash of the session ID is taken to compute two sub directories, resulting in session files being stored as:
You can see the pattern used for session ids: the IP address of the client making the request, a timestamp indicating the start of the session, and the PID of the process. However, this is used only when the targetted session ID is free, otherwise, a random cryptic session ID is generated.
Because sessions will use disk space, you need an expiration policy. If someone attempts to continue a session that has been removed,
CGI::MxScreenwill return an error, and that someone will have to restart the whole session, thereby potentially loosing all the work already done.
On my web server, I use the following command to expire sessions after a week of inactivity:
cd /var/tmp/web-sessions find . -type f -atime +7 | xargs rm -f
The creation routine takes the following arguments:
Mandatory argument, giving the root directory where sessions are saved.
Optional argument, defining the timeout after which a lock is declared stale. Defaults is 60 seconds.
Optional, tells whether session files are read from a local or a network filesystem (e.g. NFS). Assumes local filesystem by default.
You can configure this session medium in the configuration file as explained in CGI::MxScreen::Config by saying:
$mx_medium = ["+File", -directory => "/var/tmp/www-sessions"];
You can further say:
$mx_serializer = ["+Storable", -compress => 1];
to store sessions in compressed forms, although I advise you not to, for performance reasons. Actually, you should look at CGI::MxScreen::Session::Medium::Raw_File if you want fast session files.
Raphael Manfredi <Raphael_Manfredi@pobox.com>
Module Install Instructions
To install CGI::MxScreen, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install CGI::MxScreen
For more information on module installation, please visit the detailed CPAN module installation guide.