Cataly...licated(3pm)

πŸ“¦
version 0.66 Β· 5 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… 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::Schema
  • DBIx::Class
  • DBIx::Class::Storage::DBI::Replicated
  • Catalyst::TraitFor::Model::DBIC::Schema::Caching

✨ AUTHOR ✨

see AUTHOR in Catalyst::Model::DBIC::Schema and CONTRIBUTORS in Catalyst::Model::DBIC::Schema. they did that. πŸ”₯


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