TTL Index
Using Time-To-Live Index to automatically deleting entities.
// Other imports go here...
import java.util.Date;
// Lombok's annotations go here..
// en2do - Expires 10 seconds after timeStamp of "createDate"
@TTLIndex(value = "createTime", ttl = 10, unit = TimeUnit.SECONDS)
// en2do - Expires on timeStamp of "expireDate"
@TTLIndex(value = "expireTime")
public class Customer {
@Id // en2do
UUID uniqueId;
// Other fields go here...
Date createTime; // Important for 1. TTLIndex annotation
Date expireTime; // Important for 2. TTLIndex annotation
}Last updated