DBIx::...:Cached(3pm)
β¨ NAME β¨
DBIx::Class::Cursor::Cached β it's a cursor class, bestie, and it comes with built-in caching support π (this one lives in the 3pm manual section, iykyk)
πΈ SYNOPSIS πΈ
okay so here's the whole vibe, literally copy-paste ready:
my $schema = SchemaClass->connect(
$dsn, $user, $pass, { cursor_class => 'DBIx::Class::Cursor::Cached' }
);
$schema->default_resultset_attributes({
cache_object => Cache::FileCache->new({ namespace => 'SchemaClass' }),
});
my $rs = $schema->resultset('CD')->search(undef, { cache_for => 300 });
my @cds = $rs->all; # fills cache
$rs = $schema->resultset('CD')->search(undef, { cache_for => 300 });
# refresh resultset
@cds = $rs->all; # uses cache, no SQL run
$rs->cursor->clear_cache; # deletes data from cache
@cds = $rs->all; # refills cache
no cap, that # uses cache, no SQL run line is the whole moment. the SQL just... doesn't run. iconic. π
π AUTHOR π
Matt S Trout <mst@shadowcat.co.uk> β also findable at http://www.shadowcat.co.uk/ π¦
Initial development sponsored by and (c) Takkle, Inc. 2007 β¨
π LICENSE π
This library is free software under the same license as perl itself π«Ά
and that's the whole page, babe β no crumbs left behind π
source/version check: perl v5.38.2 π and this was dated 2024-03-05 π so if you're reading this from the future, hi, hope the caching is still slaying π bye bestie!! π§β¨
π¦ where this page comes from
- debian trixie: libdbix-class-cursor-cached-perl 1.001004-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdbix-class-cursor-cached-perl 1.001004-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-class-cursor-cached-perl 1.001004-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-class-cursor-cached-perl 1.001004-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