RTIME, can be read and
set, but not
Amount of time the object should be cached for. By default, the value of
beresp.ttl will be parsed from the
Expires headers received from the backend. Setting this variable takes
precedence over those headers.
Try it out
beresp.ttl is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.
Overriding TTLs based on content type
Set TTLs at the edge based on the type of resource. Better done at origin, but this can be a great 'quick fix' or a solution if you don't control the origin.
Serve stale on origin failure
Deal with all potential scenarios for using stale content to satisfy requests when origin is unhealthy or misbehaving.
User contributed notes
We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.