NAME
Cache::KyotoTycoon::Cursor - Cursor class for KyotoTycoon
SYNOPSIS
use Cache::KyotoTycoon;
my $kt = Cache::KyotoTycoon->new(...);
my $cursor = $kt->make_cursor(1);
$cursor->jump();
while (my ($k, $v) = $cursor->get(1)) {
print "$k: $v";
}
$cursor->delete;
METHODS
- $kt->jump([$key]);
-
Jump the cursor.
$key: destination record of the jump. The first key if missing.
Return: not useful
- $kt->jump_back([$key]);
-
Jump back the cursor. This method is only available on TreeDB.
$key: destination record of the jump. The first key if missing.
Return: 1 if succeeded, 0 if the record is not exists.
Exception: die if /rpc/jump_back is not implemented.
- $kt->step();
-
Move cursor to next record.
Return: 1 if succeeded, 0 if the next record is not exists.
- $kt->step_back()
-
Step the cursor to the previous record.
Return: 1 on success, or 0 on failure.
- $kt->set_value($xt, $step);
-
Set the value of the current record.
$value the value.
$xt the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.
$step true to move the cursor to the next record, or false for no move.
Return: 1 on success, or 0 on failure.
- $kt->remove();
-
Remove the current record.
Return: 1 on success, or 0 on failure.
- my $key = $kt->get_key([$step])
-
Get the key of the current record.
$step: true to move the cursor to the next record, or false for no move.
Return: key on success, or undef on failure.
- my $value = $kt->get_value([$step]);
-
Get the value of the current record.
$step: true to move the cursor to the next record, or false for no move.
Return: value on success, or undef on failure.
- my ($key, $value) = $kt->get([$step]);
-
Get a pair of the key and the value of the current record.
$step: true to move the cursor to the next record, or false for no move.
Return: pair of key and value on success, or empty list on failure.
- $kt->delete();
-
Delete the cursor immidiately.
Return: not useful.