Remove $session->commit, and hence remove manager to make Session
[catagits/Web-Session.git] / lib / Plack / Middleware / Session.pm
index a4e91e1..15c4d6e 100644 (file)
@@ -58,11 +58,7 @@ sub call {
     $env->{'psgix.session.options'} = { id => $id };
 
     if ($self->session_class) {
-        $env->{'plack.session'} = $self->session_class->new(
-            manager => $self,
-            _data   => $env->{'psgix.session'},
-            options => $env->{'psgix.session.options'},
-        );
+        $env->{'plack.session'} = $self->session_class->new($env);
     }
 
     my $res = $self->app->($env);
@@ -87,7 +83,7 @@ sub commit {
 sub finalize {
     my($self, $session, $options, $response) = @_;
 
-    $self->commit($session, $options);
+    $self->commit($session, $options) unless $options->{no_store};
     if ($options->{expire}) {
         $self->state->expire_session_id($options->{id}, $response);
     } else {