Dancer::Plugin::Redis - easy database connections for Dancer applications
version 0.08
use Dancer; use Dancer::Plugin::Redis; # Calling the redis keyword will get you a connected Redis Database handle: get '/widget/view/:id' => sub { template 'display_widget', { widget => redis->get('hash_key'); }; }; dance;
Redis connection details are read from your Dancer application config - see below.
Provides an easy way to obtain a connected Redis database handle by simply calling the redis keyword within your Dancer application.
Connection details will be taken from your Dancer application config file, and should be specified as, for example:
plugins: Redis: server: '127.0.0.1:6379' debug: 0 encoding: utf8 reconnect: 60 connections: test: server: '127.0.0.1:6380' debug: 1 encoding: utf8
server is the ip:port of redis server
server
debug activate the debug of redis
debug
encoding activate auto encoding, if you want raw data, put nothing after encoding
encoding
reconnect is the number of second which try to reconnect if we have lost connection, default to 60
reconnect
Calling redis will return a connected database handle; the first time it is called, the plugin will establish a connection to the database, and return a reference to the DBI object. On subsequent calls, the same DBI connection object will be returned. The connection will be refresh automatically with the Redis reconnect option.
redis
If you have declared named connections as described above in 'DEFINING MULTIPLE CONNECTIONS', then calling the database() keyword with the name of the connection as specified in the config file will get you a database handle connected with those details.
This module is developed on Github at:
https://github.com/geistteufel/Dancer-Plugin-Redis
Feel free to fork the repo and submit pull requests!
Please report any bugs or feature requests to bug-dancer-plugin-database at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer-Plugin-Redis. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-dancer-plugin-database at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Dancer::Plugin::Redis
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dancer-Plugin-Redis
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Dancer-Plugin-Redis
CPAN Ratings
http://cpanratings.perl.org/d/Dancer-Plugin-Redis
Search CPAN
http://search.cpan.org/dist/Dancer-Plugin-Redis/
Github project https://github.com/geistteufel/Dancer-Plugin-Redis
You can find the author on IRC in the channel #dancer on <irc.perl.org>.
#dancer
Dancer
DBI
Redis
Geistteufel <geistteufel@celogeek.fr>
This software is copyright (c) 2011 by Geistteufel <geistteufel@celogeek.fr>.
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 Dancer::Plugin::Redis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::Redis
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::Redis
For more information on module installation, please visit the detailed CPAN module installation guide.