问题
What is the maximum value we can assign to TTL ?
In the java driver for cassandra TTL is set as a int. Does that mean it is limited to Integer.MAX (2,147,483,647 secs) ?
回答1:
The maximum TTL is actually 20 years. From org.apache.cassandra.db.ExpiringCell
:
public static final int MAX_TTL = 20 * 365 * 24 * 60 * 60; // 20 years in seconds
I think this is verified along both the CQL and Thrift query paths.
回答2:
I don't know why do you need this but default TTL is null in Cassandra which means it won't be deleted until you force.
One very powerful feature that Cassandra provides is the ability to expire data that is no longer needed. This expiration is very flexible and works at the level of individual column values. The time to live (or TTL) is a value that Cassandra stores for each column value to indicate how long to keep the value.
The TTL value defaults to null, meaning that data that is written will not expire.
https://www.oreilly.com/library/view/cassandra-the-definitive/9781491933657/ch04.html
来源:https://stackoverflow.com/questions/26846959/max-value-for-ttl-in-cassandra