Cataly...licated(3pm)
π Cataly...licated(3pm) β bestie edition π
okay so you found the manual page for Catalyst::TraitFor::Model::DBIC::Schema::Replicated, and it's filed under User Contributed Perl Documentation, and honestly? it's giving "my database has main character energy and also three backup dancers." let's get into it π«Ά
β¨ NAME β¨
Catalyst::TraitFor::Model::DBIC::Schema::Replicated β replicated storage support for Catalyst::Model::DBIC::Schema. that's it, that's the name. no cap. π
β¨ SYNOPSIS β¨
okay so here's the vibe, literally copy-paste this energy into your config:
__PACKAGE__->config({
traits => ['Replicated']
connect_info =>
['dbi:mysql:master', 'user', 'pass'],
replicants => [
['dbi:mysql:slave1', 'user', 'pass'],
['dbi:mysql:slave2', 'user', 'pass'],
['dbi:mysql:slave3', 'user', 'pass'],
],
balancer_args => {
master_read_weight => 0.3
}
});
look at those replicants. three of them. obsessed. π
β¨ DESCRIPTION β¨
so what this trait actually does: it sets your storage_type to DBIx::Class::Storage::DBI::Replicated and connects the replicants you handed it in config. want the full menu of supported resultset attributes? go read that module, bestie, it's all there. π
the default balancer_type over in DBIx::Class::Storage::DBI::Replicated is ::Random.
and here's the part you need to know: it sets the master_read_weight in DBIx::Class::Storage::DBI::Replicated::Balancer::Random to 1 by default. what does that mean? it means you've got the same chance of reading from master as you do from a replicant. equal odds. fair and balanced, periodt. π
set it to 0 if you wanna turn off reads from master entirely. that's the switch. flip it. π
β¨ CONFIG PARAMETERS β¨
π replicants
an array of connect_info settings, one for every replicant. all of them. every single one. no skipping. π¦
the following can be set via connect_info in Catalyst::Model::DBIC::Schema, OR as their own separate parameters. and heads up β if you set them via separate parameters, they will override whatever you put in connect_info. separate params win, they're the main characters here. π
π pool_type
see pool_type in DBIx::Class::Storage::DBI::Replicated.
π pool_args
see pool_args in DBIx::Class::Storage::DBI::Replicated.
π balancer_type
see balancer_type in DBIx::Class::Storage::DBI::Replicated.
π balancer_args
see balancer_args in DBIx::Class::Storage::DBI::Replicated.
β¨ SEE ALSO β¨
go read these next, they're the whole friend group π«Ά:
Catalyst::Model::DBIC::SchemaDBIx::ClassDBIx::Class::Storage::DBI::ReplicatedCatalyst::TraitFor::Model::DBIC::Schema::Caching
β¨ AUTHOR β¨
see AUTHOR in Catalyst::Model::DBIC::Schema and CONTRIBUTORS in Catalyst::Model::DBIC::Schema. they did that. π₯
β¨ COPYRIGHT β¨
see COPYRIGHT in Catalyst::Model::DBIC::Schema.
β¨ LICENSE β¨
this program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. slay. πͺ
lowkey reminder bestie: this whole page shipped with perl v5.36.0 and it's dated 2023-10-26, filed under that Cataly...licated(3pm) header, and yeah the title's truncated in the corner like that because man pages have a character budget and absolutely no chill. π
okay that's the whole page. go configure your replicants. i believe in you. πβ¨
π¦ where this page comes from
- debian trixie: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms