PET::Session::RamdiskHash

PET::Session::RamdiskHash

This is a very lightweight session handler optimized for speed.  In therory, it stores session data in RAMDISK -- however, it needs a PATH so optionally that could mean a regular disk, too.

Sessions are stored in a key:value\n form in a text file.  According to the first 2 md5 chars, derectories are created at “init” time.

This session implementation can only store one level of key/value pairs!  Make sure that keys are ^\w+$ !

Summary
PET::Session::RamdiskHashThis is a very lightweight session handler optimized for speed.
Functions
initCreates the 16*16 subdirectories for later use.
loadLoad session from disk and returns it.
accessSession is accessed.
storeStore $self->{SESSION} by $self->{SESID} to disk.
_getPathAccording to sesid, returns a path to the file we store our session data.
thaw($bin)Returns the hashref (thawed) data.
freeze($data)Returns freezed “binary” data.

Functions

init

sub init

Creates the 16*16 subdirectories for later use.  Needs “session/ramdiskapth” in global.conf

load

sub load

Load session from disk and returns it.  This is called from start.

access

sub access

Session is accessed.  We have to “touch”.

store

sub store

Store $self->{SESSION} by $self->{SESID} to disk.

_getPath

sub _getPath

According to sesid, returns a path to the file we store our session data.

thaw($bin)

sub thaw($)

Returns the hashref (thawed) data.  Needs the “binary” input in a string.

freeze($data)

sub freeze($)

Returns freezed “binary” data.  Needs a hashref.

This is a base session implementation.
sub init
Creates the 16*16 subdirectories for later use.
sub load
Load session from disk and returns it.
sub access
Session is accessed.
sub store
Store $self->{SESSION} by $self->{SESID} to disk.
sub _getPath
According to sesid, returns a path to the file we store our session data.
sub thaw($)
Returns the hashref (thawed) data.
sub freeze($)
Returns freezed “binary” data.
sub start
This method is called at each page.
Close