---
title: obj.ttl
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/variables/cache-object/obj-ttl
---

**Type:** RTIME  
**Access:** can be read and set, but not unset

**Available in:** hit, error, log

Maximum amount of time for which the object will be considered [fresh](https://www.fastly.com/documentation/guides/concepts/edge-state/cache/cache-freshness).  If the object is not evicted from cache before this time elapses, it will become [stale](https://www.fastly.com/documentation/guides/concepts/edge-state/cache/stale).

This variable is writable only in `vcl_hit` and `vcl_error`. Doing so in `vcl_error` does nothing because error objects are not cacheable. Setting `obj.ttl` in `vcl_hit` will only be effective if the value is zero (and will trigger the object to be purged); otherwise, it will retain its existing TTL.
