I have a Table
CREATE TABLE myTable (
id bigint,
other_id text,
my_set SET<bigint>,
my_date timestamp,
PRIMARY KEY (id, other_id)
);
I want to have a common TTL within all columns, so after the TTL expires, the row disappears.
I manage to INSERT new rows with:
INSERT INTO myTable (id, other_id, my_date, my_set)
VALUES (1,'foo','2014-10-20 12:05:08-0300', {22})
USING TTL 20;
I also can UPDATE my set adding new elements with:
UPDATE myTable USING TTL 20 SET my_set=my_set + {99}
WHERE id=1 AND other_id='foo';
BUT my problem is that this new element has a new TTL, so after some time the number 22 disappears and 99 is still present.
How can I add a new element to my set with the same TTL of the other elements of the set?
The solution I am thinking of is to make two queries:
- Ask my_date column his TTL
- With that TTL make the UPDATE adding a new element to my_set
Is there a better solution?