README
1INSTALLATION
2
3To install this module type the following:
4
5 perl Makefile.PL
6 make
7 make test
8 make install
9
10Documentation is provided in the module and perldoc output is copied below:
11
12NAME
13 Redis::hiredis − interact with Redis using the hiredis client.
14
15SYNOPSIS
16 use Redis::hiredis;
17 my $redis = Redis::hiredis−>new();
18 $redis−>connect('127.0.0.1', 6379);
19 $redis−>command('set foo bar');
20 $redis−>command(["set", "foo", "bar baz"]); # values with spaces
21 my $val = $redis−>command('get foo');
22
23 # to pipeline commands
24 $redis−>append_command('set abc 123');
25 $redis−>append_command('get abc');
26 my $set_status = $redis−>get_reply(); # 'OK'
27 my $get_val = $redis−>get_reply(); # 123
28
29DESCRIPTION
30 "Redis::hiredis" is a simple wrapper around Salvatore Sanfilippo’s
31 hiredis C client that allows connecting and sending any command just
32 like you would from a command line Redis client.
33
34 NOTE Versions >= 0.9.2 and <= 0.9.2.4 are not compatible with prior
35 versions
36
37 METHODS
38
39
40 new([utf8 => 1], [host => "localhost"], [port => 6379], [path => "/tmp/redis.sock"])
41 Creates a new Redis::hiredis object.
42
43 If the host attribute is provided the "connect" method will
44 automatically be called.
45
46 If the path attribute is provided the "connect_unix" method will
47 automatically be called.
48
49 connect( $hostname, $port )
50 $hostname is the hostname of the Redis server to connect to
51
52 $port is the port to connect on. Default 6379
53
54 connect_unix( $path )
55 $path is the path to the unix socket
56
57 command( $command_and_args )
58 command( [ $command, $arg, ... ] )
59 command( $command, $arg, ... )
60 command supports multiple types of calls to be backwards compatible
61 and provide more convenient use. Examples of how to pass arguments
62 are:
63
64 $redis−>command('set foo bar');
65 $redis−>command(["set", "foo", "bar baz"]);
66 $redis−>command("set", "foo", "bar baz");
67
68 Note that if you have spaces in your values, you must use one of
69 the last 2 forms.
70
71 command will return a scalar value which will either be an integer,
72 string or an array ref (if multiple values are returned).
73
74 append_command( $command )
75 For performance reasons, it’s sometimes useful to pipeline
76 commands. When pipelining, muiltple commands are sent to the
77 server at once and the results are read as they become available.
78 hiredis supports this via append_command() and get_reply().
79 Commands passed to append_command() are buffered locally until the
80 first call to get_reply() when all the commands are sent to the
81 server at once. The results are then returned one at a time via
82 calls to get_reply().
83
84 See the hiredis documentation for a more detailed explanation.
85
86 get_reply()
87 See append_command().
88
89 Autoloaded Methods
90
91 Autoload is used to allow an interface like $redis−>set("foo", "bar").
92 The method name you provide will be passed blindly to Redis, so any
93 supported command should work.
94
95 Note that to use any autoloaded method, you must pass arguments as an
96 array, the string and array ref forms supported by command will not
97 work.
98
99SEE ALSO
100 The Redis command reference can be found here:
101 <http://redis.io/commands>
102
103 A discusion of pipelining can be found here:
104 <http://redis.io/topics/pipelining>
105
106 Documentation on the hiredis client can be found here:
107 <https://github.com/antirez/hiredis>
108
109 Redis::hiredis on github: <https://github.com/neophenix/redis−hiredis>
110