Cataly...aching(3pm)
β¨ NAME β¨
Catalyst::TraitFor::Model::DBIC::Schema::Caching β bestie, it's literally query caching support for Catalyst::Model::DBIC::Schema. That's the whole vibe. π
(also it's a 3pm page, so it's Perl module documentation, iykyk)
πΈ SYNOPSIS πΈ
okay so here's how you set it up, no cap:
__PACKAGE__->config({
traits => ['Caching'],
connect_info =>
['dbi:mysql:db', 'user', 'pass'],
});
$c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });
that's it. that's the whole thing. slay. π«Ά
π DESCRIPTION π
So the way this works is it enables caching support using DBIx::Class::Cursor::Cached and Catalyst::Plugin::Cache. Two little icons doing all the heavy lifting.
For this to actually work tho β and this is important, don't skip it β Catalyst::Plugin::Cache must be configured and loaded. A possible configuration would look like this:
<Plugin::Cache>
<backend>
class Cache::FastMmap
unlink_on_exit 1
share_file /tmp/myapp_share
</backend>
</Plugin::Cache>
Then, in your queries, you set the cache_for ResultSet attribute to the number of seconds you want the query results to be cached for, eg.:
$c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });
yes bestie, 18000 seconds. go off. π₯
π CONFIG PARAMETERS π
caching
Turn caching on or off, you can use:
$c->model('DB')->caching(0);
lowkey the simplest switch ever. 0 means off, and honestly the vibes of turning it off when you need fresh data? immaculate. π
π¦ SEE ALSO π¦
Catalyst::Model::DBIC::SchemaDBIx::ClassCatalyst::Plugin::CacheCache::FastMmapDBIx::Class::Cursor::Cached
go read all of them, they're iconic fr fr π
π AUTHOR π
See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in Catalyst::Model::DBIC::Schema.
(not me writing it out twice, but the original says both so both you get π)
π 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.
basically: it's Perl-licensed, go forth and remix responsibly π§
and that's the whole page bestie, mwah π This was perl v5.36.0, dated 2023-10-26, from the User Contributed Perl Documentation, page Cataly...aching(3pm). bestie behaviour honestly, periodt. ππΈ
π¦ 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