By default, data you store in Sync is permanent: Twilio will not delete your data for you, and you can rely on it always being there. If you do explicitly delete your data, we will delete it immediately per our commitment to GDPR principles. But otherwise, Twilio will retain your Sync objects indefinitely and you can expect your data to be there.
For purposes of garbage collection, or even time-based user experiences, we also provide a Time-to-live (TTL) feature. A TTL value, assignable to any Sync object (including items within Maps and Lists) specifies the approximate time before the object is automatically garbage-collected by Twilio, disappearing from SDKs and from the REST API.
This TTL setting is fixed and does not advance automatically with data updates. If you want to move a timer forward automatically, you must explicitly provide a new TTL value with the next data update.
The following code pushes a List Item. This item will disappear approximately a week later.
1const weekInSeconds = 7 * 24 * 3600;2syncClient.list('notification_history').then(function(list) {3list.push({4title: 'New message arrived'5}, {6ttl: weekInSeconds7});8});
In favor of high scale, Sync's TTL implementation sacrifices accurate firing times. While you can rely on these timers to drive timed application behavior, you should expect that long timers fire inaccurately: up to minutes away from the moment of expiry. They will often be more accurate than this in practice.