NAME
Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool
SYNOPSIS
package MyApp::Model::MyDB;
use Moose;
extends 'Catalyst::Model::DBIC::Schema';
with 'Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool';
sub build_connect_key {
my ($self, $c) = @_;
return $c->stash->{client}->name;
}
sub build_connect_info {
my ($self, $c) = @_;
return $c->stash->{client}->db_connect_info;
}
1;
DESCRIPTION
This role handles a pool of connections for your Catalyst::Model::DBIC::Schema model. For each request, your model defines a connection key with "build_connect_key". This role then looks for the storage for that connection and applies it to your model's schema. If no storage has been built previously for this connection key then your model returns the connect_info for it from build_connect_info.
Your model must implmeent both build_connect_key and build_connect_info.
REQUIRED METHODS
build_connect_key ($app, $c)
Must return a unique identifier for the schema connection this request should use.
build_connect_info ($app, $c)
Must return a list of the connect_info for "connection" in DBIx::Class::Schema.
SEE ALSO
Catalyst::Model::DBIC::Schema DBIx::Class::Schema
AUTHOR
Gareth Kirwan, gbjk at cpan.org