NAME
Web::Session::Cassandra - Apache::Session backend to store sessions in a Cassadra database.
SYNOPSIS
use Web::Session::Cassandra;
my $args = {
DataSource => 'dbi:Cassandra:host=localhost;keyspace=llng',
UserName => $db_user,
Password => $db_pass,
# Choose your browseable fileds
Index => '_whatToTrace _session_kind _utime iAddr',
};
# Use it like Apache::Session
my %session;
tie %session, 'Web::Session::Cassandra', $id, $args;
$session{uid} = 'me';
$session{mail} = 'me@me.com';
$session{unindexedField} = 'zz';
untie %session;
DESCRIPTION
Web::Session::Cassandra is an implementation of Apache::Session for Cassandra database.
SCHEMA
To use this module, you will need at least these columns in a table called 'sessions':
id text
a_session text
To create this schema, you can execute this command using cqlsh:
CREATE TABLE sessions (
id text PRIMARY KEY,
a_session text
);
CONFIGURATION
The module must know what datasource, username, and password to use when connecting to the database. These values can be set using the options hash (see Apache::Session documentation). The options are DataSource, UserName, and Password.
Example:
tie %hash, 'Apache::Session::Cassandra', $id, {
DataSource => 'dbi:Cassandra:host=localhost;keyspace=llng',
UserName => 'database_user',
Password => 'K00l'
};
Instead, you may pass in an already-opened DBI handle to your database.
tie %hash, 'Apache::Session::Cassandra', $id, {
Handle => $dbh
};
searchLt() AND searchGt()
They take the same arguments and return the same data as searchOn(): sessions whose field is lower (or greater) than the given value, which is excluded. The value must be a number (12, -12 or 12.5): otherwise nothing is returned and an error is printed on STDERR. Spaces around the value are ignored.
They read all sessions and compare fields in Perl: a non-numeric field value is compared as 0, or as its numeric prefix.
Sessions without the field are never returned, as with the other backends of this distribution. This differs from the Perl fallback of Lemonldap::NG, where a missing field is compared as 0.
The connection is kept open between sessions. Set noreuse => 1 to open and close one for each session, see "PERSISTENT DATABASE CONNECTIONS" in Web::Session.
SEE ALSO
Apache::Session, Apache::Session::DBI
COPYRIGHT AND LICENSE
Copyright (C):
- 2009-2026 by Xavier Guimard
- 2013-2025 by Clément Oudot
- 2019-2025 by Maxime Besson
- 2013-2025 by Worteks
- 2023-2026 by Linagora
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.