Skip to content

Commit

Permalink
Fix Cassandra doc
Browse files Browse the repository at this point in the history
  • Loading branch information
guimard committed Jul 6, 2023
1 parent 15bc051 commit 0dbc095
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Module::Build->new(
'Redis' => 0,
},
test_requires => { DBI => 0, 'DBD::SQLite' => 0, },
dist_version => '1.3.12',
dist_version => '1.3.13',
autosplit => [qw(lib/Apache/Session/Browseable/_common.pm)],
configure_requires => { 'Module::Build' => 0, },
meta_merge => {
Expand Down
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Revision history for Perl extension Apache::Session::Browseable.

1.3.13
- Fix versions
- Update Cassandra doc

1.3.12
- Add Cassandra support via DBD::Cassandra

Expand Down
10 changes: 5 additions & 5 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
"provides" : {
"Apache::Session::Browseable" : {
"file" : "lib/Apache/Session/Browseable.pm",
"version" : "v1.3.12"
"version" : "v1.3.13"
},
"Apache::Session::Browseable::Cassandra" : {
"file" : "lib/Apache/Session/Browseable/Cassandra.pm",
"version" : "v1.3.12"
"version" : "v1.3.13"
},
"Apache::Session::Browseable::DBI" : {
"file" : "lib/Apache/Session/Browseable/DBI.pm",
Expand Down Expand Up @@ -97,11 +97,11 @@
},
"Apache::Session::Browseable::Store::Cassandra" : {
"file" : "lib/Apache/Session/Browseable/Store/Cassandra.pm",
"version" : "v1.3.12"
"version" : "v1.3.13"
},
"Apache::Session::Browseable::Store::DBI" : {
"file" : "lib/Apache/Session/Browseable/Store/DBI.pm",
"version" : "v1.3.10"
"version" : "v1.3.11"
},
"Apache::Session::Browseable::Store::File" : {
"file" : "lib/Apache/Session/Browseable/Store/File.pm",
Expand Down Expand Up @@ -165,6 +165,6 @@
"url" : "https://github.com/LemonLDAPNG/Apache-Session-Browseable"
}
},
"version" : "v1.3.12",
"version" : "v1.3.13",
"x_serialization_backend" : "JSON::PP version 4.07"
}
10 changes: 5 additions & 5 deletions META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ name: Apache-Session-Browseable
provides:
Apache::Session::Browseable:
file: lib/Apache/Session/Browseable.pm
version: v1.3.12
version: v1.3.13
Apache::Session::Browseable::Cassandra:
file: lib/Apache/Session/Browseable/Cassandra.pm
version: v1.3.12
version: v1.3.13
Apache::Session::Browseable::DBI:
file: lib/Apache/Session/Browseable/DBI.pm
version: v1.3.9
Expand Down Expand Up @@ -59,10 +59,10 @@ provides:
version: v1.2.2
Apache::Session::Browseable::Store::Cassandra:
file: lib/Apache/Session/Browseable/Store/Cassandra.pm
version: v1.3.12
version: v1.3.13
Apache::Session::Browseable::Store::DBI:
file: lib/Apache/Session/Browseable/Store/DBI.pm
version: v1.3.10
version: v1.3.11
Apache::Session::Browseable::Store::File:
file: lib/Apache/Session/Browseable/Store/File.pm
version: v1.2.2
Expand Down Expand Up @@ -113,5 +113,5 @@ requires:
resources:
license: http://dev.perl.org/licenses/
repository: https://github.com/LemonLDAPNG/Apache-Session-Browseable
version: v1.3.12
version: v1.3.13
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
4 changes: 3 additions & 1 deletion lib/Apache/Session/Browseable.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Apache::Session::Browseable;

our $VERSION = '1.3.12';
our $VERSION = '1.3.13';

print STDERR "Use a sub module of Apache::Session::Browseable such as Apache::Session::Browseable::File";

Expand Down Expand Up @@ -63,6 +63,8 @@ chosen module documentation carefully to set the indexes.
=item L<Apache::Session::Browseable::Redis>
=item L<Apache::Session::Browseable::Cassandra>
=back
=head1 SEE ALSO
Expand Down
81 changes: 80 additions & 1 deletion lib/Apache/Session/Browseable/Cassandra.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
40 changes: 17 additions & 23 deletions lib/Apache/Session/Browseable/Store/Cassandra.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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'
};
Expand All @@ -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
Expand Down

0 comments on commit 0dbc095

Please sign in to comment.