TTL And Invalidations Flashcards
What is TTL (Time-to-Live)?
TTL is a setting that determines how long content (like web pages, images, and other files) is stored in a cache before it is considered stale and needs to be refreshed from the origin server.
Why is TTL important in content delivery?
TTL helps balance between reducing load on the origin server and ensuring that users receive the most up-to-date content. It optimizes both performance and resource usage.
What are invalidations?
Invalidation is a process used in content delivery networks to remove files from a cache before the end of their configured TTL. This forces the next request for these files to be served from the origin server, ensuring that updated content is delivered.
When should invalidations be used?
Invalidations are typically used when you need to urgently replace cached content with updated versions, such as after fixing errors in content or updating critical information on a website.
What does Cache-Control: max-age specify?
It sets the maximum age in seconds that a resource can be considered fresh and served from the cache.
What does Cache-Control: s-maxage control?
It sets how long (in seconds) a shared cache (like a CDN) can keep the content before it needs to be revalidated or fetched again.
What does the Expires header do?
It specifies the exact time after which the content is considered outdated and must be fetched anew from the source.