From: Dobrica Pavlinusic Date: Sun, 22 Mar 2009 18:42:21 +0000 (+0000) Subject: flushdb, flushall X-Git-Tag: 0.0801~22 X-Git-Url: http://git.rot13.org/?p=perl-Redis.git;a=commitdiff_plain;h=b8ff672c10960796e47cb49ff17473f2bb136375;ds=inline flushdb, flushall git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@41 447b33ff-793d-4489-8442-9bea7d161be5 --- diff --git a/lib/Redis.pm b/lib/Redis.pm index 267fcc2..6b0916d 100644 --- a/lib/Redis.pm +++ b/lib/Redis.pm @@ -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<< >> diff --git a/t/01-Redis.t b/t/01-Redis.t index 2480695..85e9c93 100755 --- a/t/01-Redis.t +++ b/t/01-Redis.t @@ -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' );