Perl模块Cassandra :: Lite问题

时间:2014-05-22 10:44:18

标签: perl cassandra

使用此模块在cassandra中添加和删除行时遇到以下问题。   如果我们为cassandra增加价值,但是当你尝试使用

删除它时,这是可以的
$cassandra_handle->delete( 'coumn_family', $key);

它只删除键的值,但不删除键。如果密钥尚未存在,则将其添加到其中。

为什么会这样?模块本身有问题吗?

1 个答案:

答案 0 :(得分:0)

我猜这是模块的问题。你可以尝试perlcassa。

  

虽然存在其他Perl Cassandra客户端,例如Cassandra :: Lite   和Net :: Cassandra他们没有针对许多变化进行更新   在Cassandra发布> 0.80 - perlcassa

我浏览了源代码,你可以使用remove子程序。

##########################################################################
# remove() lets you remove a key
#
##########################################################################
sub remove() {
    my ($self, %opts) = @_;

    eval {
        if (defined($self->{timeout})) {
            local $SIG{ALRM} = sub { die "Remove timed out"; };
            my $alarm = alarm($self->{timeout});
            $self->_call("remove", %opts);
            alarm($alarm);
        } else {    
            $self->_call("remove", %opts);
        }

        close_conn();
    };

    if ($@) {
        my %error = %{$@};
        die("[ERROR] Remove was unsuccessful: $error{why}");
    }

}