I know this is an old question, but for any googlers that come wanting an answer on version 2.x +, here is the DataStax document on Live Time Definition (TTL). Using CQL with the excelsior keyspace and clicks column family, you create your table as usual:
CREATE TABLE excelsior.clicks ( userid uuid, url text, name text, PRIMARY KEY (userid, url) );
When you insert your data, you specify the USING TTL , followed by the number of seconds during which the data must be stored for:
INSERT INTO excelsior.clicks ( userid, url, name) VALUES ( 3715e600-2eb0-11e2-81c1-0800200c9a66, 'http://apache.org', 'Mary') USING TTL 86400;
Please note that 86400 is the number of seconds per day. You can also set TTL using a prepared statement in the Java CQL Driver by simply processing it like any other related parameter:
String strCQL = "INSERT INTO excelsior.clicks (userid, url, name) " + "VALUES (?,?,?) USING TTL ? "; boundStatement = new BoundStatement(statement); mySession.execute(boundStatement.bind( UUID.fromString("3715e600-2eb0-11e2-81c1-0800200c9a66"), "http://apache.org", "Mary", 86400) );
source share