Catalyst::Model::Riak - Basho/Riak model class for Catalyst
version 0.01
# Use this to create a new model script/myapp_create.pl model ModelName Riak http:/192.168.0.1:8089 900 # In you controller use my $coder = JSON::XS->new->utf8->pretty->allow_nonref; # # Set bucket # $c->model("ModelName")->bucket('Bucket'); # # Create a key/value pair in the bucket $c->model('ModelName')->create( { key => 'key', value => $coder->encode($data) } ); # # Read key/value pair from the 'Bucket' my $object = $c->model('ModelName')->get({ key => 'key' }); # # Update a key/value pair in the bucket $c->model('ModelName')->update( { key => 'key', value => $code->encode($newdata) } ); # # Delete a key/value pair from the bucket $c->model('ModelName')->delete( { key => 'key' } ); # # Or # # # Create a key/value pair my $object = $c->model("ModelName")->bucket('Container')->new_object('key', $coder->encode($data) ); $object->store; # # Get a key/value pair my $object = $c->model("ModelName")->bucket('Container')->get('key'); # # Update a key/value pair $object->data($coder->encode($newdata)); # # Delete a key/value pair $object->delete;
Use this model set create a new Catalyst::Model::Riak model for your Catalyst application. Check the Net::Riak documentation for addtional information. Also visit http://www.basho.com for more information on Riak.
Set the bucket and returns a Net::Riak::Bucket object.
$c->model("ModelName")->bucket("Container");
Returns an array of all available buckets.
Creates a new key/value pair
$c->model("ModelName")->create({ key => 'keyname', value => $json_data });
Deletes a key/value pair
Get a key/value pair from the riak server. It returns a Net::Riak::Object.
Synonym for get
Update a key/value pair
$c->model('ModelName')->update( { key => 'key', value => $json_data } );
Get or set the number of partitions to wait for write confirmation
Get or set the number of responding partitions to wait for while writing or updating a value
Get or set the number of responding partitions to wait for while retrieving an object
Repository
https://github.com/Mainframe2008/CatRiak Pull request and additional contributors are welcome
Issue Tracker
https://github.com/Mainframe2008/CatRiak/issues
Theo Bot <nltbo@cpan.org> http://www.proxy.nl
This software is copyright (c) 2013 by Theo Bot
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 Catalyst::Model::Riak, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Model::Riak
CPAN shell
perl -MCPAN -e shell install Catalyst::Model::Riak
For more information on module installation, please visit the detailed CPAN module installation guide.