Mojolicious::Plugin::StaticCache - Mojolicious Plugin
# Mojolicious $self->plugin('StaticCache'); # With options $self->plugin('StaticCache' => { even_in_dev => 1, max_age => 2592000 }); # Mojolicious::Lite plugin 'StaticCache'; # With options plugin 'StaticCache' => { even_in_dev => 1, max_age => 2592000 };
Mojolicious::Plugin::StaticCache is a Mojolicious plugin which add a Control-Cache header to each static file served by Mojolicious.
Mojolicious::Plugin::StaticCache supports the following options.
# Mojolicious $self->plugin('StaticCache' => { even_in_dev => 1 });
Add the Cache-Control header even if Mojolicious mode is not 'production'.
Default is to not add the Cache-Control header if the mode is not 'production'.
# Mojolicious $self->plugin('StaticCache' => { max_age => 2592000 });
Specify the maximum cache time for the Cache-Control header.
Default is 2592000.
# Mojolicious $self->plugin('StaticCache' => { cache_control => 'max-age=2592000, must-revalidate' });
Specify the content of the Cache-Control header.
Default is "max-age=$max_age, must-revalidate".
Mojolicious::Plugin::StaticCache inherits all methods from Mojolicious::Plugin and implements the following new ones.
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
The latest source code can be browsed and fetched at:
https://framagit.org/luc/mojolicious-plugin-staticcache git clone https://framagit.org/luc/mojolicious-plugin-staticcache.git
Bugs and feature requests will be tracked at:
https://framagit.org/luc/mojolicious-plugin-staticcache/issues
Luc DIDRY CPAN ID: LDIDRY ldidry@cpan.org https://fiat-tux.fr/
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
Mojolicious, Mojolicious::Guides, http://mojolicious.org.
To install Mojolicious::Plugin::StaticCache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::StaticCache
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::StaticCache
For more information on module installation, please visit the detailed CPAN module installation guide.