UNIQUE (k)
)
- $dbh->do('CREATE INDEX IF NOT EXISTS idx_v ON kv (v)');
$dbh;
}
}
$self;
}
+sub index_values {
+ my ($self) = @_;
+ my $lock = $self->lock_for_scope;
+ $self->dbh($lock)->do('CREATE INDEX IF NOT EXISTS idx_v ON kv (v)');
+}
+
sub set_maybe {
my ($self, $key, $val, $lock) = @_;
$lock //= $self->lock_for_scope;
is($skv->xchg($dead, undef), $cafe, 'xchg to undef');
is($skv->get($dead), undef, 'get after xchg to undef');
is($skv->get($cafe), $dead, 'get after set_maybe');
+ok($skv->index_values, 'index_values works');
is($skv->replace_values($dead, $cafe), 1, 'replaced one by value');
is($skv->get($cafe), $cafe, 'value updated');
is($skv->replace_values($dead, $cafe), 0, 'replaced none by value');