AlgoViz

Cache TTL

easy 24 min

A time to live (TTL) says how long a cached copy may be used.

Where it shows up

The same pattern appears across everyday software.

  • DNS

    Every record carries a TTL. Teams lower it before moving a service, so that resolvers forget the old address sooner.

  • CDN content

    CloudFront keeps objects for 24 hours by default when nothing else is set; cache policies and response headers change that.

  • Web sessions

    A session key gets a new expiry on each request and disappears after inactivity, with a maximum total age.

  • Caffeine

    The Java library separates `expireAfterWrite` (absolute), `expireAfterAccess` (sliding) and `refreshAfterWrite`.

  • Static assets

    A file name with a content hash never changes meaning, so it can be cached for a year. A new version has a new name.

  • Exchange-rate widgets

    A rate shown on a page may be seconds old; the rate used for a payment is read from the source.