$self->_sock_result_bulk_list( 'SINTER', @_ );
}
$self->_sock_result_bulk_list( 'SINTER', @_ );
}
+=head2 sinterstore
+
+ my $ok = $r->sinterstore( $dstkey, $key1, $key2, ... );
+
+=cut
+
+sub sinterstore {
+ my $self = shift;
+ $self->_sock_send_ok( 'SINTERSTORE', @_ );
+}
+
=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 => 84;
+use Test::More tests => 86;
$o->sadd( 'test-set1', $_ ) foreach ( 'foo', 'bar', 'baz' );
$o->sadd( 'test-set2', $_ ) foreach ( 'foo', 'baz', 'xxx' );
$o->sadd( 'test-set1', $_ ) foreach ( 'foo', 'bar', 'baz' );
$o->sadd( 'test-set2', $_ ) foreach ( 'foo', 'baz', 'xxx' );
-is_deeply( [ $o->sinter( 'test-set1', 'test-set2' ) ], [ 'baz', 'foo' ], 'siter' );
+my $inter = [ 'baz', 'foo' ];
+
+is_deeply( [ $o->sinter( 'test-set1', 'test-set2' ) ], $inter, 'siter' );
+
+ok( $o->sinterstore( 'test-set-inter', 'test-set1', 'test-set2' ), 'sinterstore' );
+
+cmp_ok( $o->scard( 'test-set-inter' ), '==', $#$inter + 1, 'cardinality of intersection' );