Bread::Board::LifeCycle::Session - A short-lived singleton for Bread::Board
version v0.900.1
use Bread::Board; my $c = container 'Reports' => as { service generic_report => ( class => 'Report', lifecycle => 'Session', ); }; sub dispatch { # ... dispatch code ... my $services_flushed = $c->flush_session_instances; }
This implements a short-term "Session" lifecycle for Bread::Board. Services with this lifecycle will exist as a singleton until they are flushed with the flush_session_instances method. The idea is that this method would be called at the end of a web request, but a "session" could be defined as any sort of short-term cycle.
The Bread::Board::Container::Role::WithSessions role is applied to all containers that exist in or around the service.
This module is similar to Bread::Board::LifeCycle::Request, but has no connections to OX.
Thanks to Grant Street Group http://www.grantstreet.com for funding development of this code.
Thanks to Steve Grazzini (<GRAZZ@CPAN.org>) for discussion of the concept.
<GRAZZ@CPAN.org>
Grant Street Group <developers@grantstreet.com>
This software is Copyright (c) 2015 - 2020 by Grant Street Group.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Bread::Board::LifeCycle::Session, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bread::Board::LifeCycle::Session
CPAN shell
perl -MCPAN -e shell install Bread::Board::LifeCycle::Session
For more information on module installation, please visit the detailed CPAN module installation guide.