Nile::Plugin::Cache - Cache plugin for the Nile framework.
my $cash = $app->plugin->cache; # save visitors count to the cache $cash->set("visitor_count", $cash->get("visitor_count") + 1, "1 year"); # retrieve visitors count from the cache $view->set("visitor_count", $cash->get("visitor_count"));
Returns the CHI object. All CHI methods are supported.
Plugin settings in th config file under plugin section. The autoload variable is must be set to true value for the plugin to be loaded on application startup to setup hooks to work before actions dispatch:
plugin
autoload
<plugin> <cache> <autoload>0</autoload> <driver>File</driver> <root_dir></root_dir> <namespace>cache</namespace> </cache> </plugin>
For DBI driver configuration example:
<driver>DBI</driver> <namespace>cache</namespace> <table_prefix>cache_</table_prefix> <create_table>1</create_table>
The DBI create table example:
CREATE TABLE <table_prefix><namespace> ( `key` VARCHAR(...), `value` TEXT, PRIMARY KEY (`key`) )
The driver will try to create the table if you set create_table in the config and table does not exist.
create_table
This project is available on github at https://github.com/mewsoft/Nile.
Please visit the project's homepage at https://metacpan.org/release/Nile.
Source repository is at https://github.com/mewsoft/Nile.
See Nile for details about the complete framework.
Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com
Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Nile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nile
CPAN shell
perl -MCPAN -e shell install Nile
For more information on module installation, please visit the detailed CPAN module installation guide.