Net::Cassandra - Interface to Cassandra


Net-Cassandra documentation  | view source Contained in the Net-Cassandra distribution.

Index


NAME

Top

Net::Cassandra - Interface to Cassandra

SYNOPSIS

Top

  my $cassandra = Net::Cassandra->new( hostname => 'localhost' );
  my $client    = $cassandra->client;

  my $key       = '123';
  my $timestamp = time;

  eval {
      $client->insert(
          'Keyspace1',
          $key,
          Net::Cassandra::Backend::ColumnPath->new(
              { column_family => 'Standard1', column => 'name' }
          ),
          'Leon Brocard',
          $timestamp,
          Net::Cassandra::Backend::ConsistencyLevel::ZERO
      );
  };
  die $@->why if $@;

  eval {
      my $what = $client->get(
          'Keyspace1',
          $key,
          Net::Cassandra::Backend::ColumnPath->new(
              { column_family => 'Standard1', column => 'name' }
          ),
          Net::Cassandra::Backend::ConsistencyLevel::QUORUM
      );
      my $value     = $what->column->value;
      my $timestamp = $what->column->timestamp;
      warn "$value / $timestamp";
  };
  die $@->why if $@;

  eval {
      $client->remove(
          'Keyspace1',
          $key,
          Net::Cassandra::Backend::ColumnPath->new(
              { column_family => 'Standard1', column => 'name' }
          ),
          $timestamp
      );
  };
  die $@->why if $@;

DESCRIPTION

Top

This module provides an interface the to Cassandra distributed database. It uses the Thrift interface. This is changing rapidly and supports version 0.5.0 of Cassandra.

AUTHOR

Top

Leon Brocard <acme@astray.com>.

COPYRIGHT

Top

LICENSE

Top

This module is free software; you can redistribute it or modify it under the same terms as Perl itself.


Net-Cassandra documentation  | view source Contained in the Net-Cassandra distribution.