Skip to Content
Mastering Apache Cassandra 3.x - Third Edition
book

Mastering Apache Cassandra 3.x - Third Edition

by Aaron Ploetz, Tejaswi Malepati
October 2018
Beginner to intermediate content levelBeginner to intermediate
348 pages
10h
English
Packt Publishing
Content preview from Mastering Apache Cassandra 3.x - Third Edition

The expiring cell

Apache Cassandra allows for data in cells to be expired. This is called setting a TTL. TTLs can be applied at write-time, or they can be enforced at the table level with a default value. To set a TTL on a row at write time, utilize the USING TTL clause:

INSERT INTO query_test (pk1,pk2,ck3,ck4,c5)VALUES ('f','g','c4','d6','e7')USING TTL 86400;

Likewise, TTLs can also be applied with the UPDATE statement:

UPDATE query_testUSING TTL 86400SET c5='e7'WHERE pk1='f' AND pk2='g' AND ck3='c4' AND ck4='d6';

TTLs represent the number of seconds elapsed since write-time.

One day is 86,400 seconds.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Apache Cassandra - Second Edition

Mastering Apache Cassandra - Second Edition

Nishant Neeraj

Publisher Resources

ISBN: 9781789131499Supplemental Content