TTL

TTL, which stands for time to live, is the amount of time that a packet, DNS record, or other data exists before being discarded by a router. TTL limits the lifespan of data within a network by attaching a time limit to data.

You can use TTL for CDN caching and DNS caching.

DNS and Domains

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 caches 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.

Spaces

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.

TTL Articles

A guide to setting up additional hostnames and verifying them using the Community DNS Lookup tool
Choose and set eviction policies for your Caching database clusters
Set the Spaces CDN’s edge cache TTL or purge the cache to manage when edge servers refresh their content.