Cataly...:Store(3pm)
π NAME π
Catalyst::Plugin::Cache::Store β bestie, this is literally the glow-up guide on how to write a Cache store plugin β¨
π SYNOPSIS π
okay so here's the whole vibe in one code block, no notes:
package Catalyst::Plugin::Cache::Store::Frobnicator;
sub setup_frobnicator_cache_backend {
my ( $app, $name, $config ) = @_;
....
$app->register_cache_backend( $name => $cache_object );
}
that's it. that's the whole thing. iconic π
β¨ DESCRIPTION β¨
so you wanna write a cache store plugin? say less π«Ά fr fr, all you need is to implement one method, and it follows a naming convention, periodt:
setup_<<lower case store name>>_cache_backend {
}
like, for example, setup_fastmmap_cache_backend for Catalyst::Plugin::Cache::Store::FastMmap πΈ
and then inside that method you call register_cache_backend. that's the moment. that's the main character energy right there π
the method will get the backend name and configuration as its first and second arguments. yup, in that order, don't mix them up bestie π
lowkey the best part? all invocation of the setup methods will be automatic, based on the configuration. the plugin does the work, you just sit there looking pretty π§β¨
but β and this is important β the plugin must be loaded by the user. no plugin load, no setup method, no slay. that part is on them π
also, heads up: store plugins are only necessary if some configuration defaults that are catalyst specific need to be provided. if that sentence sounds like it's doing a lot, it's because it is π
for most cases, simply using a cache class instead of a plugin is sufficient. easy, breezy, done π¦
okay that's the whole page, bestie!! π this was documented in perl v5.34.0, dated 2022-06-09 β yeah, it's giving vintage, but she still eats πβ π
π¦ where this page comes from
- debian bookworm: libcatalyst-plugin-cache-perl 0.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-plugin-cache-perl 0.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-plugin-cache-perl 0.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-plugin-cache-perl 0.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-plugin-cache-perl 0.12-3 Β· 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