TTL, also known as time to live or hop limit, is the amount of time (also called hops) that a packet exists before being discarded by a router. TTL limits the lifespan of data within a network through attaching a time limit to data.
You can use TTL for CDN caching and DNS caching.
All DNS records have a TTL that specifies how long a record should remain in a resolver’s cache before the resolver should query a DNS name server for an updated set of records for a hostname. This means if a DNS record has a TTL of 3600 seconds (1 hour), a resolver will cache the record for 3600 seconds after it receives the initial query for a hostname.
DNS propagation is the process of allowing DNS records’ TTLs to expire in resolver caches across the internet. This is why your DNS changes may not be immediately apparent upon updating. Loading data from a local cache is fast, but visitors won’t see DNS changes until their local cache expires and updates with a new DNS lookup. Higher TTL values give visitors faster performance and lower TTL values pick up DNS changes quickly.
All DNS records require a minimum TTL value of 30 seconds.
For DigitalOcean Spaces, the edge cache TTL determines how long the CDN’s edge servers keep a particular copy of your files before getting the current version from the origin. A longer TTL gives better performance with the tradeoff that users won’t see updated content until the existing content expires.
For more static content that doesn’t change often, or if you expect a large increase in traffic, you may want to set a longer TTL. For more dynamic content that does change often, you may want to use a shorter TTL. If you want the TTL for specific files to differ from the default of the Spaces bucket, you can add a custom key-value pair to the file’s metadata.