The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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

$cursor->jump([$key]);

Jump the cursor.

$key: destination record of the jump. The first key if missing.

Return: not useful

$cursor->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.

$cursor->step();

Move cursor to next record.

Return: 1 if succeeded, 0 if the next record is not exists.

$cursor->step_back()

Step the cursor to the previous record.

Return: 1 on success, or 0 on failure.

$cursor->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.

$cursor->remove();

Remove the current record.

Return: 1 on success, or 0 on failure.

my $key = $cursor->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 = $cursor->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, $xt) = $cursor->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, value and expiration time on success, or empty list on failure.

$cursor->delete();

Delete the cursor immediately.

Return: not useful.