remove Store::CHI
Masahiro Chiba [Sun, 13 Dec 2009 06:15:44 +0000 (15:15 +0900)]
lib/Plack/Middleware/Session.pm
lib/Plack/Session/Store/CHI.pm [deleted file]
t/000_load.t
t/005_basic_w_cache_store.t [moved from t/007_basic_w_cache_store.t with 100% similarity]
t/005_basic_w_chi_store.t [deleted file]

index 1254d4f..aff0685 100644 (file)
@@ -120,11 +120,9 @@ This will persist session data in a file. By default it uses
 L<Storable> but it can be configured to have a custom serializer and
 deserializer.
 
-=item L<Plack::Session::Store::CHI>
+=item L<Plack::Session::Store::Cache>
 
-This will persist session data using the L<CHI> module. This
-offers a lot of flexibility due to the many excellent L<CHI>
-drivers available.
+This will persist session data using the L<Cache> interface.
 
 =item L<Plack::Session::Store::Null>
 
diff --git a/lib/Plack/Session/Store/CHI.pm b/lib/Plack/Session/Store/CHI.pm
deleted file mode 100644 (file)
index 1e2956b..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-package Plack::Session::Store::CHI;
-use strict;
-use warnings;
-
-use Scalar::Util qw/blessed/;
-
-use parent 'Plack::Session::Store';
-
-use Plack::Util::Accessor qw[ chi ];
-
-sub new {
-    my ($class, %params) = @_;
-    unless ( blessed $params{chi} and $params{chi}->isa('CHI::Driver') ) {
-        die('require chi driver');
-    }
-    bless { %params } => $class;
-}
-
-sub fetch {
-    my ($self, $session_id, $key) = @_;
-    my $cache = $self->chi->get($session_id);
-    return unless $cache;
-    return $cache->{ $key };
-}
-
-sub store {
-    my ($self, $session_id, $key, $data) = @_;
-    my $cache = $self->chi->get($session_id);
-    if ( !$cache ) {
-        $cache = {$key => $data};
-    }
-    else {
-        $cache->{$key} = $data;
-    }
-    $self->chi->set($session_id => $cache);
-}
-
-sub delete {
-    my ($self, $session_id, $key) = @_;
-    my $cache = $self->chi->get($session_id);
-    return unless exists $cache->{$key};
-
-    delete $cache->{ $key };
-    $self->chi->set($session_id => $cache);
-}
-
-sub cleanup {
-    my ($self, $session_id) = @_;
-    $self->chi->remove($session_id);
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-Plack::Session::Store::CHI - CHI session store
-
-=head1 SYNOPSIS
-
-  use Plack::Builder;
-  use Plack::Session::Store::CHI;
-  use CHI;
-
-  my $app = sub {
-      return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
-  };
-
-  builder {
-      enable 'Session',
-          store => Plack::Session::Store::CHI->new(
-              chi => CHI->new(driver => 'FastMmap')
-          );
-      $app;
-  };
-
-=head1 DESCRIPTION
-
-This will persist session data using the L<CHI> module. This
-offers a lot of flexibility due to the many excellent L<CHI>
-drivers available.
-
-This is a subclass of L<Plack::Session::Store> and implements
-it's full interface.
-
-=head1 METHODS
-
-=over 4
-
-=item B<new ( %params )>
-
-The constructor expects an the I<chi> param to be an
-instance of L<CHI::Driver>, it will throw an exception
-if that is not the case.
-
-=item B<chi>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Masahiro Chiba
-
-=cut
index 7b9a3ca..0d89c7f 100644 (file)
@@ -9,10 +9,10 @@ use_ok( $_ ) || BAIL_OUT foreach qw[
     Plack::Middleware::Session
     Plack::Session
     Plack::Session::Store
-    Plack::Session::Store::CHI
+    Plack::Session::Store::Cache
     Plack::Session::Store::File
     Plack::Session::State
     Plack::Session::State::Cookie
 ];
 
-done_testing;
\ No newline at end of file
+done_testing;
diff --git a/t/005_basic_w_chi_store.t b/t/005_basic_w_chi_store.t
deleted file mode 100644 (file)
index 97e624d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use Test::Requires 'CHI';
-
-use Test::More;
-
-use Plack::Request;
-use Plack::Session;
-use Plack::Session::State;
-use Plack::Session::Store::CHI;
-
-use t::lib::TestSession;
-
-t::lib::TestSession::run_all_tests(
-    store           => Plack::Session::Store::CHI->new( chi => CHI->new(driver => 'Memory', datastore => {}) ),
-    state           => Plack::Session::State->new,
-    request_creator => sub {
-        open my $in, '<', \do { my $d };
-        my $env = {
-            'psgi.version'    => [ 1, 0 ],
-            'psgi.input'      => $in,
-            'psgi.errors'     => *STDERR,
-            'psgi.url_scheme' => 'http',
-            SERVER_PORT       => 80,
-            REQUEST_METHOD    => 'GET',
-        };
-        my $r = Plack::Request->new( $env );
-        $r->parameters( @_ );
-        $r;
-    },
-);
-
-
-done_testing;