Catalyst-Plugin-Session

 view release on metacpan or  search on metacpan

lib/Catalyst/Plugin/Session/Store.pm  view on Meta::CPAN

    $c->store_session_data( $x, $y );

for any $x,

    $y == $c->get_session_data( $x )

will hold.

=item store_session_data ( $key, $data )

Store a session whose KEY is the first parameter and data is the second
parameter in storage.

The second parameter is a hash reference, which should normally be
serialized (and later deserialized by C<get_session_data>).

=item delete_session_data ( $key )

Delete the session whose KEY is the parameter.

=item delete_expired_sessions

This method is not called by any code at present, but may be called in the
future, as part of a Catalyst-specific maintenance script.

If you are wrapping around a backend which manages its own auto expiry
you can just give this method an empty body.

=back

=head2 Error handling

All errors should be thrown using L<Catalyst::Exception>. Return values
are not checked, and are assumed to be OK. Missing values are not errors.

=head2 Auto-Expiry on the Backend

Storage plugins are encouraged to use C<< $c->session_expires >>, C<<
$c->config('Plugin::Session' => { expires => $val }) >>, or the storage of the
C<expires:$sessionid> key to perform more efficient expiration, but only
for the key prefixes C<session>, C<flash> and C<expires>.

If the backend chooses not to do so, L<Catalyst::Plugin::Session> will
detect expired sessions as they are retrieved and delete them if
necessary.

Note that session store that use this approach may leak disk space,
since nothing will actively delete an expired session. The
C<delete_expired_sessions> method is there so that regularly scheduled
maintenance scripts can give your backend the opportunity to clean up.

=head2 Early Finalization

By default the main session plugin will finalize during body finalization
which ensures that all controller code related to the session has completed.
However some storage plugins may wish to finalize earlier, during header
finalization.  For example a storage that saved state in a client cookie
would wish this.  If a storage plugin wants to finalize early it should set
$c->_needs_early_session_finalization to true.  Please note that if you
do this in a storage plugin, you should warn users not to attempt to change
or add session keys if you use a streaming or socket interface such as
$c->res->write, $c->res->write_fh or $c->req->io_fh.

=cut




( run in 1.436 second using v1.01-cache-2.11-cpan-140bd7fdf52 )