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   146160 use strict;
  1         3  
  1         30  
4              
5 1     1   592 use Apache::Session;
  1         1964  
  1         32  
6 1     1   514 use Apache::Session::Lock::Null;
  1         205  
  1         30  
7 1     1   463 use Apache::Session::Browseable::Store::Cassandra;
  1         2  
  1         27  
8 1     1   438 use Apache::Session::Generate::SHA256;
  1         2  
  1         34  
9 1     1   456 use Apache::Session::Serialize::JSON;
  1         3  
  1         33  
10 1     1   418 use Apache::Session::Browseable::DBI;
  1         2  
  1         152  
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 AUTHOR
101              
102             This module was written by Mike Langen , based
103             on the original for Oracle.
104              
105             =head1 SEE ALSO
106              
107             L, L
108             1;
109