Nginx::Redis - asynchronous redis client for nginx-perl
use Nginx::Redis; ngx_redis '127.0.0.1:6379', ['GET', 'mykey'], sub { my ($reply) = @_; unless ($reply) { warn "error: no reply from redis\n"; return; } # $reply = ['$', 'myvalue'] };
Fast asynchronous redis client for nginx-perl that supports pipelining and doesn't provide any command-bound interface. You can use it for almost any feature of redis. Currently it doesn't support pub/sub-like flow though.
Nginx::Redis relies on Redis::Parser::XS to parse reply messages. So you have to install it as well.
ngx_redis ngx_redis_client ngx_redis_request
Encodes and sends request to the redis server specified by $ip:$port. If password is specified in $auth then AUTH command will precede.
$ip:$port
$auth
Calls back with reply in $_[0]. Format of the reply described in Redis::Parser::XS.
$_[0]
On error calls back without any arguments. Tries to reconnect on the next request.
Every connection is cached forever.
Example:
ngx_redis '127.0.0.1', ['PING'], sub { my ($reply) = @_; # $reply = ['+', 'PONG'] };
Alexandr Gomoliako <zzz@zzz.org.ua>
Copyright 2011 Alexandr Gomoliako. All rights reserved.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
To install Nginx::Redis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nginx::Redis
CPAN shell
perl -MCPAN -e shell install Nginx::Redis
For more information on module installation, please visit the detailed CPAN module installation guide.