Mojolicious::Plugin::Cache::Page - Page caching plugin
version 0.0015
Mojolicious:
$self->plugin('cache-page');
Mojolicious::Lite:
plugin 'cache-page';
This plugin caches the entire output of controller action in a HTML file which can be delivered directly by the webserver without even going through the controller at all. The cache will generate files for example user/2/view.html, user/new.html etc which matches the request urls. The webserver picks up the existing file by matching the path otherwise it gets passed to the mojolicious controller.
The cache is named according to path and so the cache will not differentiate between an identical page that is accessed from tucker.myplace.com/user/2/view.html and from caboose.myplace.com/user/2/view.html. This caching system ignores the query parameters. So, for example /users?page=1 will be cached as users.html and so another call to /users?page=2 will retrieve the users.html. The cache is expired by deleting the html file that defered it creation until a new request comes in.
actions => [qw/action1 action2 ....] #Mojolicious::Lite plugin cache-page => { actions => [qw/user show/]}; By default, all actions with successful GET requests will be cached
By default, for mojolicious lite application the current working directory is set for page caching. For mojolicious application it is set to the B<public> folder. #Mojolicious lite using memcache plugin cache-page => { cache_direcotry => '/home/page_cache' };
Siddhartha Basu <biosidd@gmail.com>
This software is copyright (c) 2010 by Siddhartha Basu.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mojolicious::Plugin::Cache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Cache
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Cache
For more information on module installation, please visit the detailed CPAN module installation guide.