Perl Jedi Plugin Session

Jedi::Plugin::Session is an extension for Perl Jedi to give your the possibility to store session for your user.

The plugin will automatically generate and save an UUID for the visiting user, and extend the Jedi::Request to add the methods : session_get and session_set.

You have not limit (except your memory) on how many data you store for each user. You can only store serializable object.

The plugin session has for now 3 engines :

I may add a file engine soon. If needed.

On the Redis and SQLite engines allow you to share for the same app launching in multiple workers the session.

Each app has his own session data.

The UUID store in a cookie in the browser of the user is only a part of the final UUID. If someone steal that cookie, it will have a different session. If you change the browser also you will have a different session.

Let show an example of how to use it :

The session is not necessary a ‘HASH’. But it is often simpler to save a session this way.

If the user is a new one, or his session has expire, then the session data will be undef.

If you want to reset the expiration time you can do :

To use another engine, it is simple :

Each engine can be configured with the Jedi configuration.

You can take a look at the possibility with the BACKENDS doc.

Each engine should work without any configuration. SQLite will store the data in the dist_dir of the Jedi::Plugin::Session, and create a session file per app. The Redis will use the default port to store the session.

Enjoy !

Celogeek

Short URL: http://sck.pm/KM37