1 package Plack::Session::Store;
6 our $AUTHORITY = 'cpan:STEVAN';
8 use Plack::Util::Accessor qw[ _stash ];
11 my ($class, %params) = @_;
12 $params{'_stash'} ||= +{};
13 bless { %params } => $class;
17 my ($self, $session_id) = @_;
18 $self->_stash->{ $session_id };
22 my ($self, $session_id, $session) = @_;
23 $self->_stash->{ $session_id } = $session->dump;
27 my ($self, $session_id) = @_;
28 delete $self->_stash->{ $session_id }
39 Plack::Session::Store - Basic in-memory session store
44 use Plack::Middleware::Session;
45 use Plack::Session::Store;
48 return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
52 enable 'Session'; # this is the defalt store
58 This is a very basic in-memory session data store. It is volatile
59 storage and not recommended for multiprocessing environments. However
60 it is very useful for development and testing.
62 This should be considered the store "base" class (although
63 subclassing is not a requirement) and defines the spec for
64 all B<Plack::Session::Store::*> modules. You will only
65 need to override a couple methods if you do subclass. See
66 the other B<Plack::Session::Store::*> for examples of this.
72 =item B<new ( %params )>
74 No parameters are expected to this constructor.
78 =head2 Session Data Management
80 These methods fetch data from the session storage. It's designed to
81 store or delete multiple keys at a time.
85 =item B<fetch ( $session_id )>
87 =item B<store ( $session_id, $session )>
91 =head2 Storage Management
95 =item B<cleanup ( $session_id )>
97 This method is called by the L<Plack::Session> C<expire> method and
98 is used to remove any session data.
104 All complex software has bugs lurking in it, and this module is no
105 exception. If you find a bug please either email me, or add the bug
110 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
112 =head1 COPYRIGHT AND LICENSE
114 Copyright 2009, 2010 Infinity Interactive, Inc.
116 L<http://www.iinteractive.com>
118 This library is free software; you can redistribute it and/or modify
119 it under the same terms as Perl itself.