NAME

Cassandra::Lite - Simple way to access Cassandra 0.7

VERSION

version 0.0.3

DESCRIPTION

This module will offer you a simple way to access Cassandra 0.7 (maybe later version). Some parts are not same as standard API document (especially arguments order), it's because I want to keep this module easy to use.

You'll need to install Thrift perl modules first to use Cassandra::Lite.

SYNOPSIS

use Cassandra::Lite;

# All supported options:
my $c = Cassandra::Lite->new(
            server_name => 'server1',       # optional, default to '127.0.0.1'
            server_port => 9160,            # optional, default to 9160
            username => 'username',         # optional, default to empty string ''
            password => 'xxx',              # optional, default to empty string ''
            keyspace => 'Keyspace1',
        );

# Usually we can use this in dev environment:
my $c = Cassandra::Lite->new(keyspace => 'Keyspace1');

# Now just define $columnFamily and $key
my $columnFamily = 'BlogArticle';
my $key = 'key12345';

# Insert it (timestamp is optional)
$c->insert($columnFamily, $key, {title => 'testing title', body => '...'}, {timestamp => time});

# Get slice
my $res1 = $c->get_slice($columnFamily, $key);
my $res2 = $c->get_slice($columnFamily, $key, {range => ['sliceKeyStart', undef});
my $res3 = $c->get_slice($columnFamily, $key, {range => [undef, 'sliceKeyFinish']});
my $res4 = $c->get_slice($columnFamily, $key, {range => ['sliceKeyStart', 'sliceKeyFinish']});

# Get a column
my $v = $c->get($columnFamily, $key, 'title');

# Remove it
$c->remove($columnFamily, $key, {timestamp => time});       # You can specify timestamp (optional)

# Change keyspace
$c->keyspace('BlogArticleComment');

# Get count
my $num = $c->get_count('Foo', 'key1');

...

get

get_count

get_slice

insert

remove

SEEALSO

AUTHOR

Gea-Suan Lin, <gslin at gslin.org>

LICENSE AND COPYRIGHT

Copyright 2011 Gea-Suan Lin.

This software is released under 3-clause BSD license. See http://www.opensource.org/licenses/bsd-license.php for more information.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 244:

=over should be: '=over' or '=over positive_number'

Around line 249:

You forgot a '=back' before '=head1'