Database Reference
In-Depth Information
(1 rows)
# Setting TTL is CELL LEVEL, so you need to set it
individually
cqlsh:mastering_cassandra> UPDATE demo_ttl USING TTL 60 SET
expirable_col = 'single_cell_TTL' WHERE id = 2;
cqlsh:mastering_cassandra> SELECT ttl(expirable_col),
ttl(column2) FROM demo_ttl WHERE id = 2;
ttl(expirable_col) | ttl(column2)
--------------------+--------------
56 | null
(1 rows)
# Only the cell with TTL is deleted
cqlsh:mastering_cassandra> SELECT * FROM demo_ttl;
id | column2 | expirable_col
----+---------+----------------
1 | 10 | persistent_row
2 | 30 | null
(2 rows)
# You CANNOT really just update TTL of a whole row without
actually manually updating each cell!
cqlsh:mastering_cassandra> UPDATE demo_ttl USING TTL 60
WHERE id = 2;
Bad Request: line 1:29 mismatched input 'WHERE' expecting
K_SET
# You can reset a TTL
cqlsh:mastering_cassandra> INSERT INTO demo_ttl (id,
expirable_col, column2) VALUES (3, 'some_more_time_please',
40);
cqlsh:mastering_cassandra> UPDATE demo_ttl USING TTL 30 SET
Search WWH ::




Custom Search