---
title: Segmented caching
summary: null
url: https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching
---

When you set the VCL variable `req.enable_segmented_caching` to `true` in `vcl_recv`, you enable a mode, referred to as segmented caching, in which Varnish retrieves and caches files from the origin in segments.  Segmented caching was previously known as LFS.

In this mode Varnish will spawn one or more sub-requests, each responsible for a segment of the file.  Each segment is cached independently of other segments that constitute the file.

When `vcl_log` runs in the context of such a sub-request, `segmented_caching.is_inner_req` evaluates to `true`.  This call to `vcl_log` allows you to log the outcome of each segment.

After the sequence of sub-requests has completed, `vcl_log` will run with `segmented_caching.is_outer_req` evaluating to `true`.  This call to `vcl_log` allows you to log the final outcome of the request.

- [segmented_caching.autopurged](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-autopurged/)
- [segmented_caching.block_number](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-block-number/)
- [segmented_caching.block_size](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-block-size/)
- [segmented_caching.cancelled](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-cancelled/)
- [segmented_caching.client_req.is_open_ended](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-client-req-is-open-ended/)
- [segmented_caching.client_req.is_range](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-client-req-is-range/)
- [segmented_caching.client_req.range_high](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-client-req-range-high/)
- [segmented_caching.client_req.range_low](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-client-req-range-low/)
- [segmented_caching.completed](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-completed/)
- [segmented_caching.error](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-error/)
- [segmented_caching.failed](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-failed/)
- [segmented_caching.is_inner_req](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-is-inner-req/)
- [segmented_caching.is_outer_req](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-is-outer-req/)
- [segmented_caching.obj.complete_length](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-obj-complete-length/)
- [segmented_caching.rounded_req.range_high](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-rounded-req-range-high/)
- [segmented_caching.rounded_req.range_low](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-rounded-req-range-low/)
- [segmented_caching.total_blocks](https://www.fastly.com/documentation/reference/vcl/variables/segmented-caching/segmented-caching-total-blocks/)
