I have a login session valid for 5 minutes from the last activity. If there is any activity I update the time-to-live attribute in the item by adding 5 minutes, otherwise it should get deleted at time set in 'expireAt'. But why does the item in dynamoDB not get deleted as per the time-to-live set in item 'expireAt' ?
In Java Spring-Boot, I have set EPOCH time in seconds as mentioned in the documentation login.setExpireAt((System.currentTimeMillis() / 1000) + 300);
. It does not delete item in table after 5 minutes. What alternate approach can I adopt to work around this ?
But why does the item in dynamoDB not get deleted as per the time-to-live set in item 'expireAt'
DynamoDB TTL works on a best effort basis as it provides free deletes for your table. If you item has surpassed its expiry time then it is eligible for deletion eventually, but that could be mins/hours/days in the future. If you need more strict deletions you have some choices: