flushdb, flushall
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 22 Mar 2009 18:42:21 +0000 (18:42 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 22 Mar 2009 18:42:21 +0000 (18:42 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@41 447b33ff-793d-4489-8442-9bea7d161be5

lib/Redis.pm
t/01-Redis.t

index 267fcc2..6b0916d 100644 (file)
@@ -501,6 +501,28 @@ sub move {
        $self->_sock_send( 'MOVE', $key, $dbindex );
 }
 
+=head2 flushdb
+
+  $r->flushdb;
+
+=cut
+
+sub flushdb {
+       my $self = shift;
+       $self->_sock_send_ok('FLUSHDB');
+}
+
+=head2 flushall
+
+  $r->flushall;
+
+=cut
+
+sub flushall {
+       my $self = shift;
+       $self->_sock_send_ok('flushall');
+}
+
 =head1 AUTHOR
 
 Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>
index 2480695..85e9c93 100755 (executable)
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Test::More tests => 92;
+use Test::More tests => 94;
 
 use lib 'lib';
 
@@ -157,6 +157,9 @@ ok( ! $o->exists( 'foo' ), 'gone' );
 ok( $o->select( 1 ), 'select' );
 ok( $o->exists( 'foo' ), 'exists' );
 
+ok( $o->flushdb, 'flushdb' );
+cmp_ok( $o->dbsize, '==', 0, 'empty' );
+
 diag "Connection handling";
 
 ok( $o->quit, 'quit' );