Add Apache::Session::Cassandra
Add pod Fix bug in Redis
This commit is contained in:
parent
c836db1502
commit
473e1eea4b
|
@ -11,3 +11,7 @@ Revision history for Perl extension Apache::Session::NoSQL.
|
|||
- More doc
|
||||
- Dependencies
|
||||
(revision 1599)
|
||||
|
||||
0.1 Mon Dec 6 21:54:55 +0100 2010
|
||||
- Bug: materialize does not work with Redis
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Changes
|
||||
examples/simple.pl
|
||||
lib/Apache/Session/Cassandra.pm
|
||||
lib/Apache/Session/NoSQL.pm
|
||||
lib/Apache/Session/Redis.pm
|
||||
lib/Apache/Session/Store/NoSQL.pm
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package Apache::Session::Cassandra;
|
||||
|
||||
use strict;
|
||||
use base qw(Apache::Session::NoSQL);
|
||||
|
||||
our $VERSION = '0.01';
|
||||
|
||||
sub populate {
|
||||
my $self = shift;
|
||||
$self->{args}->{Driver} = 'Cassandra';
|
||||
return $self->SUPER::populate(@_);
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Apache::Session::Cassandra - An implementation of Apache::Session
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Apache::Session::Cassandra;
|
||||
|
||||
tie %hash, 'Apache::Session::Cassandra', $id, {
|
||||
};
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is an implementation of Apache::Session::NoSQL. It uses the Cassandra
|
||||
storage system
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Xavier Guimard E<lt>x.guimard@free.frE<gt>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Apache::Session::NoSQL>, L<Apache::Session>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2010 by Thomas Chemineau
|
||||
|
||||
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.0 or,
|
||||
at your option, any later version of Perl 5 you may have available.
|
||||
|
||||
=cut
|
|
@ -9,7 +9,7 @@ use Apache::Session::Serialize::Base64;
|
|||
#use Apache::Session::Serialize::Storable;
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '0.03';
|
||||
$VERSION = '0.1';
|
||||
|
||||
sub populate {
|
||||
my $self = shift;
|
||||
|
|
|
@ -3,7 +3,7 @@ package Apache::Session::Redis;
|
|||
use strict;
|
||||
use base qw(Apache::Session::NoSQL);
|
||||
|
||||
our $VERSION = '0.01';
|
||||
our $VERSION = '0.1';
|
||||
|
||||
sub populate {
|
||||
my $self = shift;
|
||||
|
@ -36,8 +36,18 @@ storage system
|
|||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Xavier Guimard <x.guimard@free.fr>
|
||||
This module was written by Xavier Guimard E<lt>x.guimard@free.frE<gt>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Apache::Session::NoSQL>, L<Apache::Session>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2010 by Thomas Chemineau
|
||||
|
||||
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.0 or,
|
||||
at your option, any later version of Perl 5 you may have available.
|
||||
|
||||
=cut
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
package Apache::Session::Store::NoSQL::Cassandra;
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use Net::Cassandra;
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '0.01';
|
||||
$VERSION = '0.1';
|
||||
|
||||
sub new {
|
||||
my ( $class, $session ) = @_;
|
||||
|
@ -14,7 +13,7 @@ sub new {
|
|||
|
||||
$self->{cache} = Net::Cassandra->new( %{$session} )->client;
|
||||
|
||||
bless $self,$class;
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
sub insert {
|
||||
|
@ -31,10 +30,7 @@ sub insert {
|
|||
);
|
||||
}
|
||||
|
||||
sub update {
|
||||
my ( $self, $session ) = @_;
|
||||
$self->insert( %{$session} );
|
||||
}
|
||||
*update = *insert;
|
||||
|
||||
sub materialize {
|
||||
my ( $self, $session ) = @_;
|
||||
|
@ -45,8 +41,7 @@ sub materialize {
|
|||
{ column_family => 'Standard1', column => 'name' }
|
||||
),
|
||||
Net::Cassandra::Backend::ConsistencyLevel::QUORUM
|
||||
)
|
||||
or die 'Object does not exist in data store.';
|
||||
) or die 'Object does not exist in data store.';
|
||||
}
|
||||
|
||||
sub remove {
|
||||
|
@ -66,19 +61,32 @@ sub remove {
|
|||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Apache::Session::Store::NoSQL
|
||||
Apache::Session::Store::NoSQL::Cassandra - An implementation of Apache::Session::Store
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Apache::Session::NoSQL;
|
||||
|
||||
tie %hash, 'Apache::Session::Cassandra', $id, {
|
||||
};
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
=head1 SEE ALSO
|
||||
This module is an implementation of Apache::Session::NoSQL. It uses the
|
||||
Cassandra storage system
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Thomas Chemineau, E<lt>thomas.chemineau@gmail.comE<gt>
|
||||
Thomas Chemineau, E<lt>thomas.chemineau@gmail.comE<gt>,
|
||||
Xavier Guimard E<lt>x.guimard@free.frE<gt>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Apache::Session::NoSQL>, L<Apache::Session>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package Apache::Session::Store::NoSQL::Redis;
|
|||
use strict;
|
||||
use Redis;
|
||||
|
||||
our $VERSION = '0.01';
|
||||
our $VERSION = '0.1';
|
||||
|
||||
sub new {
|
||||
my ( $class, $session ) = @_;
|
||||
|
@ -24,7 +24,8 @@ sub insert {
|
|||
|
||||
sub materialize {
|
||||
my ( $self, $session ) = @_;
|
||||
$self->{cache}->get( $session->{data}->{_session_id} )
|
||||
$session->{serialized} =
|
||||
$self->{cache}->get( $session->{data}->{_session_id} )
|
||||
or die 'Object does not exist in data store.';
|
||||
}
|
||||
|
||||
|
@ -44,10 +45,9 @@ Apache::Session::Store::NoSQL::Redis - An implementation of Apache::Session::Sto
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Apache::Session::NoSQL;
|
||||
use Apache::Session::Redis;
|
||||
|
||||
tie %hash, 'Apache::Session::NoSQL', $id, {
|
||||
Driver => 'Redis',
|
||||
tie %hash, 'Apache::Session::Redis', $id, {
|
||||
# optional: default to localhost
|
||||
server => '127.0.0.1:6379',
|
||||
};
|
||||
|
@ -59,8 +59,18 @@ storage system
|
|||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Xavier Guimard <x.guimard@free.fr>
|
||||
This module was written by Xavier Guimard E<lt>x.guimard@free.frE<gt>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Apache::Session::NoSQL>, L<Apache::Session>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2010 by Thomas Chemineau
|
||||
|
||||
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.0 or,
|
||||
at your option, any later version of Perl 5 you may have available.
|
||||
|
||||
=cut
|
||||
|
|
Loading…
Reference in New Issue
Block a user