Jifty:...chable(3pm)

πŸ“¦
version 0.78 Β· 2 versions
  • 0.78 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.78 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Jifty::DBI::Record::Cachable β€” the whole vibe πŸ’–

okay bestie, welcome to the Jifty:...chable(3pm) page, from the ✨ User Contributed Perl Documentation ✨ collection. it's giving "records with caching behavior" and honestly? iconic. let's get into it. πŸ¦‹


🌸 NAME 🌸

Jifty::DBI::Record::Cachable β€” records with caching behavior. yes that's literally the whole name and yes it's exactly what it says on the tin, no cap.


✨ SYNOPSIS ✨

like, here's how you'd actually use it:

package Myrecord;
use base qw/Jifty::DBI::Record::Cachable/;

that's it. that's the whole setup. periodt. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so this module subclasses the main Jifty::DBI::Record package to add a caching layer on top. think of it like giving your records a little memory of their own. 🧠✨

the public interface stays exactly the same, bestie β€” nothing new to learn, promise. the one (1) glow-up is this: records that have been loaded in the last few seconds may be reused by subsequent fetch or load methods without retrieving them from the database. so yeah, your DB gets a lil break. she deserves it. πŸ’–


πŸ’… METHODS πŸ’…

🫢 flush_cache

this is a class method, and it flushes the _global_ Jifty::DBI::Record::Cachable cache. like, the global one. every single cache gets immediately expired. all of them. gone. bye. 😭

πŸ”₯ _flush_key_cache

blows away this record type's key cache. just the one record type, not the whole world. very targeted, very demure. πŸŽ€

⭐ load_from_hash

this one overrides the implementation from Jifty::DBI::Record so it can add caching. same energy as the original, just with extra cache sprinkled on top. ✨

🌈 load_by_cols

also overrides the implementation from Jifty::DBI::Record to add caching. twins fr fr. πŸ‘‘

πŸ¦‹ _cache_config

you can override this method to change how long the caching lasts β€” because the default is 5 seconds and maybe that's just not your girl's timeline, yk? ⏰

for example, if you wanna cache records for up to 30 seconds, add this method to your class:

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

slay. custom cache duration, exactly how you like it. πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Matt Knopp <mhat@netlag.com> β€” the icon, the legend, the moment. 🫢


🌟 SEE ALSO 🌟

  • Jifty::DBI
  • Jifty::DBI::Record

go read those too, bestie, they're part of the lore. πŸ“šβœ¨


and that's a wrap on this lil page πŸ’– it was living in perl v5.34.0, dated 2022-06-15, filed under Jifty:...chable(3pm) β€” mwah, take care of her, bye bestie!! πŸŽ€πŸŒˆπŸ’…

πŸ“¦ where this page comes from