File Coverage

blib/lib/Apache/Session/Browseable/Cassandra.pm
Criterion Covered Total %
statement 21 29 72.4
branch n/a
condition n/a
subroutine 7 8 87.5
pod 0 1 0.0
total 28 38 73.6


line stmt bran cond sub pod time code
1             package Apache::Session::Browseable::Cassandra;
2              
3 1     1   626149 use strict;
  1         3  
  1         54  
4              
5 1     1   918 use Apache::Session;
  1         3818  
  1         50  
6 1     1   793 use Apache::Session::Lock::Null;
  1         268  
  1         43  
7 1     1   737 use Apache::Session::Browseable::Store::Cassandra;
  1         4  
  1         43  
8 1     1   633 use Apache::Session::Generate::SHA256;
  1         4  
  1         48  
9 1     1   719 use Apache::Session::Serialize::JSON;
  1         5  
  1         54  
10 1     1   678 use Apache::Session::Browseable::DBI;
  1         4  
  1         243  
11              
12             our $VERSION = '1.3.13';
13             our @ISA = qw(Apache::Session::Browseable::DBI Apache::Session);
14              
15             sub populate {
16 0     0 0   my $self = shift;
17              
18             $self->{object_store} =
19 0           new Apache::Session::Browseable::Store::Cassandra $self;
20 0           $self->{lock_manager} = new Apache::Session::Lock::Null $self;
21 0           $self->{generate} = \&Apache::Session::Generate::SHA256::generate;
22 0           $self->{validate} = \&Apache::Session::Generate::SHA256::validate;
23 0           $self->{serialize} = \&Apache::Session::Serialize::JSON::serialize;
24 0           $self->{unserialize} = \&Apache::Session::Serialize::JSON::unserialize;
25              
26 0           return $self;
27             }
28              
29             1;
30              
31             =pod
32              
33             =head1 NAME
34              
35             Apache::Session::Browseable::Cassandra - Apache::Session backend to store
36             sessions in a Cassadra database.
37              
38             =head1 SYNOPSIS
39              
40             use Apache::Session::Browseable::Cassandra;
41            
42             my $args = {
43             DataSource => 'dbi:Cassandra:host=localhost;keyspace=llng',
44             UserName => $db_user,
45             Password => $db_pass,
46            
47             # Choose your browseable fileds
48             Index => '_whatToTrace _session_kind _utime iAddr',
49             };
50            
51             # Use it like Apache::Session
52             my %session;
53             tie %session, 'Apache::Session::Browseable::Cassandra', $id, $args;
54             $session{uid} = 'me';
55             $session{mail} = 'me@me.com';
56             $session{unindexedField} = 'zz';
57             untie %session;
58              
59             =head1 DESCRIPTION
60              
61             Apache::Session::Browseable::Cassandra is an implementation of Apache::Session
62             for Cassandra database.
63              
64             =head1 SCHEMA
65              
66             To use this module, you will need at least these columns in a table
67             called 'sessions':
68              
69             id text
70             a_session text
71              
72             To create this schema, you can execute this command using cqlsh:
73              
74             CREATE TABLE sessions (
75             id text PRIMARY KEY,
76             a_session text
77             );
78              
79             =head1 CONFIGURATION
80              
81             The module must know what datasource, username, and password to use when
82             connecting to the database. These values can be set using the options hash
83             (see Apache::Session documentation). The options are DataSource, UserName,
84             and Password.
85              
86             Example:
87              
88             tie %hash, 'Apache::Session::Cassandra', $id, {
89             DataSource => 'dbi:Cassandra:host=localhost;keyspace=llng',
90             UserName => 'database_user',
91             Password => 'K00l'
92             };
93              
94             Instead, you may pass in an already-opened DBI handle to your database.
95              
96             tie %hash, 'Apache::Session::Cassandra', $id, {
97             Handle => $dbh
98             };
99              
100             =head1 SEE ALSO
101              
102             L, L
103              
104             =head1 COPYRIGHT AND LICENSE
105              
106             =encoding utf8
107              
108             Copyright (C):
109              
110             =over
111              
112             =item 2009-2025 by Xavier Guimard
113              
114             =item 2013-2025 by ClĂ©ment Oudot
115              
116             =item 2019-2025 by Maxime Besson
117              
118             =item 2013-2025 by Worteks
119              
120             =item 2023-2025 by Linagora
121              
122             =back
123              
124             This library is free software; you can redistribute it and/or modify
125             it under the same terms as Perl itself, either Perl version 5.10.1 or,
126             at your option, any later version of Perl 5 you may have available.
127              
128             =cut