DBIx::...achable(3pm)

πŸ’– DBIx::SearchBuilder::Record::Cachable β€” bestie edition πŸ’–

okay so this is a page from the User Contributed Perl Documentation collection, and honestly? it's a lil bop. it lives in the DBIx::...achable(3pm) part of your filesystem, and it's about giving your records a memory. like, an actual memory. iconic behavior tbh.


✨ NAME ✨

DBIx::SearchBuilder::Record::Cachable β€” Records with caching behavior πŸŽ€


✨ SYNOPSIS ✨

bestie. look how easy this is. literally two lines:

package MyRecord;
use base qw/DBIx::SearchBuilder::Record::Cachable/;

that's it. that's the whole vibe. you just inherit and you're caching. slay. πŸ’…


✨ DESCRIPTION ✨

so here's the tea β˜• β€” this module subclasses the main DBIx::SearchBuilder::Record package and adds a whole caching layer on top of it. it's giving glow-up, it's giving efficiency, it's giving stop-hitting-the-database-so-much.

the public interface stays exactly the same, no cap. 🫢 the only difference? records that have been loaded in the last few seconds might get reused by later fetch or load methods β€” so instead of going all the way back to the database to retrieve them again, they just... already exist. we love a shortcut that isn't a safety hazard. ✨


✨ METHODS ✨

🌸 FlushCache

this is a class method, and it flushes the _global_ DBIx::SearchBuilder::Record::Cachable cache. like, all of them. every single cache. immediately expired, no survivors, no warning, no soft launch. πŸ”₯

so if you were emotionally attached to any cached record β€” goodbye. it's gone. periodt.

πŸ¦‹ _FlushKeyCache

this one blows away this record type's key cache. just the one. not the whole world, just your little corner of it. 🧚

🌈 _CacheConfig

okay this is the fun one. you can override this method to change how long the caching lasts, because the default is 5 seconds. five. seconds. it's giving "blink and you'll miss it" energy ngl.

so, for example β€” say you want to cache records for up to 30 seconds instead. you just add this method to your class:

sub _CacheConfig {
    { 'cache_for_sec' => 30 }
}

and boom πŸ’₯ you're caching for a whole thirty seconds like a main character. adjust as your heart desires, bestie. iykyk.


πŸ’€ reminder: that default is 5 seconds and it's swift. don't be out here assuming your cache is gonna hang around longer than it actually does.

and that's the whole page, no skips, no summarising, every option and example intact and accounted for. πŸ‘‘

this little masterpiece comes to you courtesy of perl v5.40.1, dated 2026-05-07, filed under DBIx::...achable(3pm). go forth and cache responsibly, bestie. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from