summary refs log tree commit diff
path: root/lib/Net
diff options
context:
space:
mode:
authorRobin Edwards <robin.ge@gmail.com>2010-11-09 09:45:57 +0000
committerfranck cuny <franck@lumberjaph.net>2010-11-25 11:00:37 +0100
commitf743f767969331089097397053f21dcd4a442ef0 (patch)
treefb4d5cd5b1d0d5bb90297eb61ab2b04108171e37 /lib/Net
parentsupport for adding bucket as objects in add method (diff)
downloadnet-riak-f743f767969331089097397053f21dcd4a442ef0.tar.gz
added delete_object method
Diffstat (limited to '')
-rw-r--r--lib/Net/Riak/Bucket.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Net/Riak/Bucket.pm b/lib/Net/Riak/Bucket.pm
index 8f263cf..0e7aa63 100644
--- a/lib/Net/Riak/Bucket.pm
+++ b/lib/Net/Riak/Bucket.pm
@@ -65,6 +65,15 @@ sub get {
     $obj;
 }
 
+sub delete_object {
+    my ($self, $key) = @_;
+    Net::Riak::Object->new(
+        client => $self->client,
+        bucket => $self,
+        key    => $key
+    )->delete;
+}
+
 sub set_property {
     my ($self, $key, $value) = @_;
     $self->set_properties({$key => $value});
@@ -159,6 +168,8 @@ sub new_object {
     my $obj2 = $bucket->new_object('foo2', {...});
     $object->store;
 
+    $bucket->delete_object($key);
+
 =head1 DESCRIPTION
 
 The L<Net::Riak::Bucket> object allows you to access and change information about a Riak bucket, and provides methods to create or retrieve objects within the bucket.
@@ -209,6 +220,12 @@ Create a new L<Net::Riak::Object> object. Additional Object constructor argument
 
 Retrieve an object from Riak.
 
+=item delete_object
+
+    $bucket->delete_object($key);
+
+Delete an object by key
+
 =item n_val
 
     my $n_val = $bucket->n_val;