The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojolicious::Plugin::Renderer::WithoutCache - Disable the template cache in your Mojo app

Coverage Status

VERSION

Version 0.04

SYNOPSIS

This plugin turns off the renderer's cache in Mojolicious and Mojo::Lite applications.

    use Mojolicious::Lite;
    plugin 'Renderer::WithoutCache';

DESCRIPTION

This does what it says on the box. It turns off caching for the Mojolicious::Renderer or any other renderer that's inside $app->renderer by injecting a cache object that does not do anything. This is supperior to setting the max_keys of Mojo::Cache to 0 if you plan to do a lot of uncached requests, becase Mojolicious::Renderer will still try to cache, and every time Mojo::Cache sets a value in the cache it looks at the max_keys, and then stops.

Doing nothing at all is cheaper. But not a lot really.

METHODS

register

Register the plugin in a Mojolicious application.

    $plugin->register(Mojolicious->new);

AUTHOR

simbabque, <simbabque at cpan.org>

BUGS

Please report any bugs or feature requests through an issue on github at https://github.com/simbabque/Mojolicious-Plugin-Renderer-WithoutCache/issues.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Mojolicious::Plugin::Renderer::WithoutCache

Why would I want to turn off the cache?

I don't know.

ACKNOWLEDGEMENTS

This plugin was inspired by Tom Hunt asking about turning the cache off on Stack Overflow.

LICENSE

Copyright (C) simbabque.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.