Net::Riak - Interface to Riak
version 0.06
my $client = Net::Riak->new(host => 'http://10.0.0.40:8098'); my $bucket = $client->bucket('blog'); my $obj = $bucket->new_object('new_post', {title => 'foo', content => 'bar'}); $obj->store; my $obj = $bucket->get('new_post');
URL of the node (default 'http://127.0.0.1:8098'). If your ring is composed with more than one node, you can configure the client to hit more than one host, instead of hitting always the same node. For this, you can do one of the following:
my $riak = Net::Riak->new( host => [ 'http://10.0.0.40:8098', 'http://10.0.0.41:8098' ] );
my $riak = Net::Riak->new( host => [ {node => 'http://10.0.0.40:8098', weight => '0.2'}, {node => 'http://10.0.0.41:8098', weight => '0.8'} ] );
Now, when a request is made, a node is picked at random, according to weight.
Interface prefix (default 'riak')
MapReduce prefix (default 'mapred')
R value setting for this client (default 2)
W value setting for this client (default 2)
DW value setting for this client (default 2)
client_id for this client
my $bucket = $client->bucket($name);
Get the bucket by the specified name. Since buckets always exist, this will always return a Net::Riak::Bucket
if (!$client->is_alive) { ... }
Check if the Riak server for this client is alive
my $map_reduce = $client->add('bucket_name', 'key');
Start assembling a Map/Reduce operation
my $map_reduce = $client->link();
my $map_reduce = $client->add('bucket_name', 'key')->map("function ...");
my $map_reduce = $client->add(..)->map(..)->reduce("function ...");
franck cuny <franck@lumberjaph.net>
This software is copyright (c) 2010 by linkfluence.
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 Net::Riak, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Riak
CPAN shell
perl -MCPAN -e shell install Net::Riak
For more information on module installation, please visit the detailed CPAN module installation guide.