Ref: https://learn.cantrill.io/courses/1820301/lectures/41301523


CF Caching - Example Scenario

  1. New image uploaded at origin
  2. User A requests image. Since no image at caching location, origin fetch performed. Image stored in Local Cache with a Time-To-Live (TTL) and returned to User A.
  3. Image is updated at origin, but image at local cache hasn't expired yet (still valid)
  4. User B requests image. Local cache returns its image (which is outdated)
  5. Image at local cache expires. It is however not ejected yet, only considered stale.
  6. User C requests image. Local cache has an expired image, so it forwards request to origin.
    1. If image at origin has been updated (like in this case), origin answers 200 OK and returns updated image. Local Cache replaces old image with updated, then returns updated image to User C.
    2. If the image at origin had NOT been updated, origin would simply respond with 304 Not Modified and Local Cache would mark the image as valid again and renew its TTL.

CF Time-To-Live (TTL) or Validity Period