-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtry
executable file
·48 lines (35 loc) · 1.23 KB
/
try
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl -w
use strict;
use warnings;
use blib;
use Cassandra;
use YAML;
my $c = Cassandra->_new;
$c->connect('localhost', 9160);
$c->set_keyspace('Keyspace1');
sub show {
print "$_[0]:\n", Dump($_[1]), "\n";
}
my $foo = $c->_get_slice('foo', 'Standard1', undef);
show 'ALL AT START', $foo;
$c->_insert('foo', 'Standard1' => { zim => 'Irken' });
$c->_insert('foo', 'Standard1' => { dib => 'Believer' });
$c->_insert('foo', 'Standard1' => { membrane => 'Professor' });
$foo = $c->_get_slice('foo', 'Standard1', undef);
show 'ALL AFTER INSERT', $foo;
for (qw( zim dib membrane )) {
$foo = $c->_get('foo', ['Standard1', undef, $_]);
show $_, $foo;
}
$foo = $c->_get_slice('foo', 'Standard1', { start => 'a', finish => 'n', count => 1 });
show 'A-N LIMIT 1', $foo;
$foo = $c->_get_slice('foo', 'Standard1', { start => 'n', finish => 'a', count => 1, reversed => 1 });
show 'N-A LIMIT 1', $foo;
$c->_remove('foo', ['Standard1', undef, 'dib']);
$foo = $c->_get_slice('foo', 'Standard1', undef);
show 'ALL AFTER REMOVING DIB', $foo;
$c->_remove('foo', 'Standard1');
$foo = $c->_get_slice('foo', 'Standard1', undef);
show 'ALL AFTER CLEARING', $foo;
$foo = $c->_get_slice('blargh', 'Standard1', undef);
show 'BLARGH, NEVER SET', $foo;