Text::...eCache(3pm)
β¨ Text::MicroMason::ExecuteCache β the manual page bestie π
okay so real talk, this is Text::MicroMason::ExecuteCache from the User Contributed Perl Documentation section of the manual, and its whole vibe is: Use a Cache for Template Results π
πΈ NAME πΈ
Text::MicroMason::ExecuteCache β Use a Cache for Template Results β¨
π¦ SYNOPSIS π¦
okay so do NOT use this class directly, bestie, that's not the move. Instead you pass its name in so it gets mixed in like a little friendship bracelet:
use Text::MicroMason;
my $mason = Text::MicroMason->new( -ExecuteCache );
Then you use the standard compile method to parse a template into a subroutine, iconic behaviour honestly:
my $subref = $mason->compile( text=>$template );
print $subref->( 'name'=>'Dave' );
and the way that the template does not have to be interpreted the second time?? because the results are cached?? we love a queen who remembers π :
print $subref->( 'name'=>'Dave' ); # fast second time
but when you run it with different arguments, the template gets re-interpreted and the results get stored, no cap:
print $subref->( 'name'=>'Bob' ); # first time for Bob
print $subref->( 'name'=>'Bob' ); # fast second time for Bob
π DESCRIPTION π
It caches the output of templates. periodt. π
okay but listen β you should not use this feature if your template code interacts with any external state, like making changes to an external data source, or obtaining values that will change in the future. like, genuinely don't. π (However!! you can still use the caching provided by Text::MicroMason::CompileCache. that one's fine. π«Ά)
β¨ Public Methods β¨
compile()β wraps each template that is compiled into a Perl subroutine in a memoizing closure. it's giving memory, it's giving efficiency π
π Supported Attributes π
execute_cacheβ defaults to an instance ofText::MicroMason::Cache::Simple. slay.
This module uses a simple cache interface that is widely supported: the only methods required are get($key) and set($key, $value). You can use the simple cache classes provided in the Text::MicroMason::Cache:: namespace, or you can select other caching modules on CPAN that support the interface described in Cache::Cache. so many options bestie, the freedom is real π¦
β SEE ALSO β
- For an overview of this templating framework, see
Text::MicroMason. π - This is a mixin class intended for use with
Text::MicroMason::Base. - For distribution, installation, support, copyright and license information, see
Text::MicroMason::Docs::ReadMe. π
and that's the whole page bestie!! this was documented with perl v5.36.0, dated 2023-08-10, from Text::...eCache(3pm) β go forth and cache responsibly, ily, mwah πβ¨π
π¦ where this page comes from
- debian trixie: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-micromason-perl 2.23-5 Β· 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