Max value for TTL in cassandra

て烟熏妆下的殇ゞ 提交于 2019-12-10 14:54:40

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!