-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
115 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ use Apache::Session::Generate::SHA256; | |
use Apache::Session::Serialize::JSON; | ||
use Apache::Session::Browseable::DBI; | ||
|
||
our $VERSION = '1.3.12'; | ||
our $VERSION = '1.3.13'; | ||
our @ISA = qw(Apache::Session::Browseable::DBI Apache::Session); | ||
|
||
sub populate { | ||
|
@@ -28,3 +28,82 @@ sub populate { | |
|
||
1; | ||
|
||
=pod | ||
=head1 NAME | ||
Apache::Session::Browseable::Cassandra - Apache::Session backend to store | ||
sessions in a Cassadra database. | ||
=head1 SYNOPSIS | ||
use Apache::Session::Browseable::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, 'Apache::Session::Browseable::Cassandra', $id, $args; | ||
$session{uid} = 'me'; | ||
$session{mail} = '[email protected]'; | ||
$session{unindexedField} = 'zz'; | ||
untie %session; | ||
=head1 DESCRIPTION | ||
Apache::Session::Browseable::Cassandra is an implementation of Apache::Session | ||
for Cassandra database. | ||
=head1 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 | ||
); | ||
=head1 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 | ||
}; | ||
=head1 AUTHOR | ||
This module was written by Mike Langen <[email protected]>, based | ||
on the original for Oracle. | ||
=head1 SEE ALSO | ||
L<Apache::Session>, L<Apache::Session::DBI> | ||
1; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ use Apache::Session::Browseable::Store::DBI; | |
use Apache::Session::Browseable::Store::Cassandra; | ||
|
||
our @ISA = qw(Apache::Session::Browseable::Store::DBI); | ||
our $VERSION = '1.3.12'; | ||
our $VERSION = '1.3.13'; | ||
|
||
our $DataSource = undef; | ||
our $UserName = undef; | ||
|
@@ -88,14 +88,14 @@ Apache::Session::Browseable::Store::Cassandra - Store persistent data in a Cassa | |
=head1 SYNOPSIS | ||
use Apache::Session::Browseable::Store::Cassandra; | ||
my $store = new Apache::Session::Browseable::Store::Cassandra; | ||
$store->insert($ref); | ||
$store->update($ref); | ||
$store->materialize($ref); | ||
$store->remove($ref); | ||
use Apache::Session::Browseable::Store::Cassandra; | ||
my $store = new Apache::Session::Browseable::Store::Cassandra; | ||
$store->insert($ref); | ||
$store->update($ref); | ||
$store->materialize($ref); | ||
$store->remove($ref); | ||
=head1 DESCRIPTION | ||
|
@@ -107,18 +107,15 @@ Apache::Session. Session data is stored in a Cassandra database. | |
To use this module, you will need at least these columns in a table | ||
called 'sessions': | ||
id char(32) # or however long your session IDs are. | ||
a_session lvarchar | ||
id text | ||
a_session text | ||
To create this schema, you can execute this command using the sqlplus program: | ||
To create this schema, you can execute this command using cqlsh: | ||
CREATE TABLE sessions ( | ||
id char(32) not null primary key, | ||
a_session lvarchar | ||
); | ||
If you use some other command, ensure that there is a unique index on the | ||
table's id column. | ||
CREATE TABLE sessions ( | ||
id text PRIMARY KEY, | ||
a_session text | ||
); | ||
=head1 CONFIGURATION | ||
|
@@ -130,7 +127,7 @@ and Password. | |
Example: | ||
tie %hash, 'Apache::Session::Cassandra', $id, { | ||
DataSource => 'dbi:Cassandra:database', | ||
DataSource => 'dbi:Cassandra:host=localhost;keyspace=llng', | ||
UserName => 'database_user', | ||
Password => 'K00l' | ||
}; | ||
|
@@ -141,9 +138,6 @@ Instead, you may pass in an already-opened DBI handle to your database. | |
Handle => $dbh | ||
}; | ||
The last option is LongReadLen, which specifies the maximum size of the session | ||
object. If not supplied, the default maximum size is 8 KB. | ||
=head1 AUTHOR | ||
This module was written by Mike Langen <[email protected]>, based | ||
|