$r->sort("key BY pattern LIMIT start end GET pattern ASC|DESC ALPHA');
=cut
$r->sort("key BY pattern LIMIT start end GET pattern ASC|DESC ALPHA');
=cut
$self->_sock_result_bulk_list( "SORT $sort" );
}
$self->_sock_result_bulk_list( "SORT $sort" );
}
+=head1 Persistence control commands
+
+=head2 save
+
+ $r->save;
+
+=cut
+
+sub save {
+ my $self = shift;
+ $self->_sock_send_ok( 'SAVE' );
+}
+
=head1 AUTHOR
Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>
=head1 AUTHOR
Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>
use warnings;
use strict;
use warnings;
use strict;
-use Test::More tests => 102;
+use Test::More tests => 103;
diag "Commands operating on string values";
ok( $o->set( foo => 'bar' ), 'set foo => bar' );
diag "Commands operating on string values";
ok( $o->set( foo => 'bar' ), 'set foo => bar' );
is_deeply( [ $o->keys('key-*') ], [ @keys ], 'keys' );
ok( my $key = $o->randomkey, 'randomkey' );
is_deeply( [ $o->keys('key-*') ], [ @keys ], 'keys' );
ok( my $key = $o->randomkey, 'randomkey' );
ok( $o->rename( 'test-incrby', 'test-renamed' ), 'rename' );
ok( $o->exists( 'test-renamed' ), 'exists test-renamed' );
ok( $o->rename( 'test-incrby', 'test-renamed' ), 'rename' );
ok( $o->exists( 'test-renamed' ), 'exists test-renamed' );
ok( $@, 'rename to existing key' );
ok( my $nr_keys = $o->dbsize, 'dbsize' );
ok( $@, 'rename to existing key' );
ok( my $nr_keys = $o->dbsize, 'dbsize' );
-diag "dbsize: $nr_keys";
diag "Commands operating on lists";
diag "Commands operating on lists";
ok( $o->flushdb, 'flushdb' );
cmp_ok( $o->dbsize, '==', 0, 'empty' );
ok( $o->flushdb, 'flushdb' );
cmp_ok( $o->dbsize, '==', 0, 'empty' );
diag "Sorting";
ok( $o->lpush( 'test-sort', $_ ), "put $_" ) foreach ( 1 .. 4 );
diag "Sorting";
ok( $o->lpush( 'test-sort', $_ ), "put $_" ) foreach ( 1 .. 4 );
is_deeply( [ $o->sort( 'test-sort' ) ], [ 1,2,3,4 ], 'sort' );
is_deeply( [ $o->sort( 'test-sort DESC' ) ], [ 4,3,2,1 ], 'sort DESC' );
is_deeply( [ $o->sort( 'test-sort' ) ], [ 1,2,3,4 ], 'sort' );
is_deeply( [ $o->sort( 'test-sort DESC' ) ], [ 4,3,2,1 ], 'sort DESC' );
+
+diag "Persistence control commands";
+
+ok( $o->save, 'save' );
+
+
diag "Connection handling";
ok( $o->quit, 'quit' );
diag "Connection handling";
ok( $o->quit, 'quit' );