From user-return-22012-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Fri Nov 4 11:47:15 2011 Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4271F9D2B for ; Fri, 4 Nov 2011 11:47:15 +0000 (UTC) Received: (qmail 4176 invoked by uid 500); 4 Nov 2011 11:47:13 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 4138 invoked by uid 500); 4 Nov 2011 11:47:13 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 4129 invoked by uid 99); 4 Nov 2011 11:47:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 11:47:13 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of camit90@gmail.com designates 209.85.216.44 as permitted sender) Received: from [209.85.216.44] (HELO mail-qw0-f44.google.com) (209.85.216.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 11:47:06 +0000 Received: by qadc10 with SMTP id c10so2561062qad.31 for ; Fri, 04 Nov 2011 04:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=cFCnUXZW6ocSAgiqeJJgAwbxYJXBro8tBeZyjwPaTr4=; b=bwVeSggGdPki9NsIXoi2me5mBCHXzdZccU+iTcIh4jDWF5jxAaDtPKXeeaysx6rgrz uqIr9z5cgMu8oUjV2tYM2YbIiHrSJ0BvH6bfJ7YFWPP0mB3kdkhJMMgpM/w+ROiXh7X8 b7ObdWRL2UvXCH1y0o8R09ivPRj9uY6a3NQcQ= MIME-Version: 1.0 Received: by 10.42.135.69 with SMTP id o5mr15362830ict.34.1320407205223; Fri, 04 Nov 2011 04:46:45 -0700 (PDT) Received: by 10.43.44.131 with HTTP; Fri, 4 Nov 2011 04:46:45 -0700 (PDT) In-Reply-To: <4EB3CC86.9040908@opensips.org> References: <4EB3CC86.9040908@opensips.org> Date: Fri, 4 Nov 2011 17:16:45 +0530 Message-ID: Subject: Re: Cassandra Counters and TTL From: Amit Chavan To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=90e6ba6e836c6d1c6504b0e7428d X-Virus-Checked: Checked by ClamAV on apache.org --90e6ba6e836c6d1c6504b0e7428d Content-Type: text/plain; charset=ISO-8859-1 Answers inline. On Fri, Nov 4, 2011 at 4:59 PM, Vlad Paiu wrote: > Hello, > > I'm a new user of Cassandra and I think it's great. > Still, while developing my APP using Cassandra, I got stuck with some > things and I'm not really sure that Cassandra can handle them at the moment. > > So, first of all, does Cassandra allow for Counters and regular Keys to be > located in the same ColumnFamily ? > What do you mean when you say "regular Keys"? If you are hinting at columns apart from counters, then the answer is *no*: only counters can exist in a CounterColumnFamily and other column families cannot hold counters. > > Secondly, is there any way to dynamically set the TTL for a key ? In the > sense that I have a key, I initially set it with no TTL, but after a while > I decide that it should expire in 100 seconds. Can Cassandra do this ? > TTL is not for one key, it is for one column. > > 3. Can counters have a TTL ? > No. Currently, counters do not (or if I am correct - cannot) have TTL. > > 4. Is there any way to atomically reset a counter ? I read on the website > that the only way to do it is read the variable value, and then set it to > -value, which seems rather bogus to me. > I think that is the only way to reset a counter. I would like to know if there is another way. Background: I am using Cassandra since the past two months. Hope the community corrects me if I am wrong. > > Regards, > > -- > Vlad Paiu > OpenSIPS Developer > > -- Regards Amit S. Chavan --90e6ba6e836c6d1c6504b0e7428d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Answers inline.

On Fri, Nov 4, 2= 011 at 4:59 PM, Vlad Paiu <vladpaiu@opensips.org> wrote:
Hello,

I'm a new user of Cassandra and I think it's great.
Still, while developing my APP using Cassandra, I got stuck with some thing= s and I'm not really sure that Cassandra can handle them at the moment.=

So, first of all, does Cassandra allow for Counters and regular Keys to be = located in the same ColumnFamily ?
What do you mean wh= en you say "regular Keys"? If you are hinting at columns apart fr= om counters, then the answer is *no*: only counters can exist in a CounterC= olumnFamily and other column families cannot hold counters.
=A0

Secondly, is there any way to dynamically set the TTL for a key ? In the se= nse that I have a key, I initially set it with no TTL, but after a while I = decide that it should expire in 100 seconds. Can Cassandra do this ?
TTL is not for one key, it is for one column.=A0
=A0

3. Can counters have a TTL ?
No. Currently, counters d= o not (or if I am correct - cannot) have TTL.=A0

4. Is there any way to atomically reset a counter ? I read on the website t= hat the only way to do it is read the variable value, and then set it to -v= alue, which seems rather bogus to me.
I think that is = the only way to reset a counter. I would like to know if there is another w= ay.

Backgro= und: I am using Cassandra since the past two months. Hope the community cor= rects me if I am wrong.
=A0

Regards,

--
Vlad Paiu
OpenSIPS Developer




-- Regards
Amit S. Chavan



--90e6ba6e836c6d1c6504b0e7428d--