dbsize
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 22 Mar 2009 09:22:39 +0000 (09:22 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 22 Mar 2009 09:22:39 +0000 (09:22 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@17 447b33ff-793d-4489-8442-9bea7d161be5

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

index 745d9ad..a2b8647 100644 (file)
@@ -237,6 +237,18 @@ sub rename {
        _sock_ok();
 }
 
+=head2 dbsize
+
+  my $nr_keys = $r->dbsize;
+
+=cut
+
+sub dbsize {
+       my ( $self ) = @_;
+       print $sock "DBSIZE\r\n";
+       _sock_result();
+}
+
 =head1 AUTHOR
 
 Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>
index ff2ee30..242a863 100755 (executable)
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Test::More tests => 52;
+use Test::More tests => 53;
 
 use lib 'lib';
 
@@ -75,4 +75,7 @@ ok( $o->exists( 'test-renamed' ), 'exists test-renamed' );
 eval { $o->rename( 'test-decrby', 'test-renamed', 1 ) };
 ok( $@, 'rename to existing key' );
 
+ok( my $nr_keys = $o->dbsize, 'dbsize' );
+diag "dbsize: $nr_keys";
+
 ok( $o->quit, 'quit' );