From b8ff672c10960796e47cb49ff17473f2bb136375 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 22 Mar 2009 18:42:21 +0000 Subject: [PATCH] flushdb, flushall git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@41 447b33ff-793d-4489-8442-9bea7d161be5 --- lib/Redis.pm | 22 ++++++++++++++++++++++ t/01-Redis.t | 5 ++++- 2 files changed, 26 insertions(+), 1 deletion(-) 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' ); -- 2.20.1