The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Cassandra::Lite - Simple way to access Cassandra 0.7

VERSION

version 0.0.2

DESCRIPTION

This module will offer a simple way to access Cassandra 0.7 (maybe later version).

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

SYNOPSIS

    use Cassandra::Lite;

    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',
            );

    my $columnFamily = 'BlogArticle';
    my $key = 'key12345';

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

    # 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
    my $v = $c->get($columnFamily, $key, 'title');

    # Remove
    $c->remove($columnFamily, $key);

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

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

    ...

get

get_count

get_slice

insert

remove

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.