line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cache::KyotoTycoon::Cursor; |
2
|
6
|
|
|
6
|
|
29
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
209
|
|
3
|
6
|
|
|
6
|
|
24
|
use warnings; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
4784
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Do not call this method manually. |
6
|
|
|
|
|
|
|
sub new { |
7
|
0
|
|
|
0
|
0
|
|
my ($class, $cursor_id, $db, $client) = @_; |
8
|
0
|
|
|
|
|
|
bless { db => $db, client => $client, cursor => $cursor_id }, $class; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub jump { |
12
|
0
|
|
|
0
|
1
|
|
my ($self, $key) = @_; |
13
|
0
|
|
|
|
|
|
my %args = (DB => $self->{db}, CUR => $self->{cursor}); |
14
|
0
|
0
|
|
|
|
|
$args{key} = $key if defined $key; |
15
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_jump', \%args); |
16
|
0
|
0
|
|
|
|
|
return 1 if $code eq 200; |
17
|
0
|
0
|
|
|
|
|
return 0 if $code eq 450; |
18
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub jump_back { |
22
|
0
|
|
|
0
|
1
|
|
my ($self, $key) = @_; |
23
|
0
|
|
|
|
|
|
my %args = (DB => $self->{db}, CUR => $self->{cursor}); |
24
|
0
|
0
|
|
|
|
|
$args{key} = $key if defined $key; |
25
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_jump_back', \%args); |
26
|
0
|
0
|
|
|
|
|
return 1 if $code eq 200; |
27
|
0
|
0
|
|
|
|
|
return 0 if $code eq 450; |
28
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub step { |
32
|
0
|
|
|
0
|
1
|
|
my ($self, ) = @_; |
33
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
34
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_step', \%args); |
35
|
0
|
0
|
|
|
|
|
return 1 if $code eq '200'; |
36
|
0
|
0
|
|
|
|
|
return 0 if $code eq '450'; |
37
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub step_back { |
41
|
0
|
|
|
0
|
1
|
|
my ($self, ) = @_; |
42
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
43
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_step_back', \%args); |
44
|
0
|
0
|
|
|
|
|
return 1 if $code eq '200'; |
45
|
0
|
0
|
|
|
|
|
return 0 if $code eq '450'; |
46
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub set_value { |
50
|
0
|
|
|
0
|
1
|
|
my ($self, $value, $xt, $step) = @_; |
51
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}, value => $value); |
52
|
0
|
0
|
|
|
|
|
$args{xt} = $xt if defined $xt; |
53
|
0
|
0
|
|
|
|
|
$args{step} = '' if defined $step; |
54
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_set_value', \%args); |
55
|
0
|
0
|
|
|
|
|
return 1 if $code eq '200'; |
56
|
0
|
0
|
|
|
|
|
return 0 if $code eq '450'; |
57
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub remove { |
61
|
0
|
|
|
0
|
1
|
|
my ($self,) = @_; |
62
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
63
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_remove', \%args); |
64
|
0
|
0
|
|
|
|
|
return 1 if $code eq '200'; |
65
|
0
|
0
|
|
|
|
|
return 0 if $code eq '450'; |
66
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub get_key { |
70
|
0
|
|
|
0
|
1
|
|
my ($self, $step) = @_; |
71
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
72
|
0
|
0
|
|
|
|
|
$args{step} = '' if defined $step; |
73
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_get_key', \%args); |
74
|
0
|
0
|
|
|
|
|
return $body->{key} if $code eq '200'; |
75
|
0
|
0
|
|
|
|
|
return if $code eq '450'; |
76
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub get_value { |
80
|
0
|
|
|
0
|
1
|
|
my ($self, $step) = @_; |
81
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
82
|
0
|
0
|
|
|
|
|
$args{step} = '' if defined $step; |
83
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_get_value', \%args); |
84
|
0
|
0
|
|
|
|
|
return $body->{value} if $code eq '200'; |
85
|
0
|
0
|
|
|
|
|
return if $code eq '450'; |
86
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub get { |
90
|
0
|
|
|
0
|
1
|
|
my ($self, $step) = @_; |
91
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
92
|
0
|
0
|
|
|
|
|
$args{step} = '' if defined $step; |
93
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_get', \%args); |
94
|
0
|
0
|
|
|
|
|
return ($body->{key}, $body->{value}, $body->{xt}) if $code eq '200'; |
95
|
0
|
0
|
|
|
|
|
return if $code eq '450'; |
96
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub delete { |
100
|
0
|
|
|
0
|
1
|
|
my ($self, ) = @_; |
101
|
0
|
|
|
|
|
|
my %args = (CUR => $self->{cursor}); |
102
|
0
|
|
|
|
|
|
my ($code, $body, $msg) = $self->{client}->call('cur_delete', \%args); |
103
|
0
|
0
|
|
|
|
|
return if $code eq '200'; |
104
|
0
|
|
|
|
|
|
die Cache::KyotoTycoon::_errmsg($code, $msg); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
__END__ |