---
title: WriteOptions
summary: Options for cache write operations (insert/update).
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/struct.WriteOptions/
---

**Kind:** Struct  
**Module:** [core](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/)  
**Package:** compute-sdk-cpp 0.7.0  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L131

Include `fastly/cache/core.h` to use this struct.

Options for cache write operations (insert/update).

## Constructor

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L143

```cpp
explicit fastly::cache::core::WriteOptions::WriteOptions(std::chrono::nanoseconds max_age)
```

**Parameters**

- `max_age`: `std::chrono::nanoseconds`

## Fields

### max_age

**Type:** `std::chrono::nanoseconds`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L132

### request_headers

**Type:** `std::optional<detail::RequestHandle>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L133

### vary_rule

**Type:** `std::optional<std::string>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L134

### initial_age

**Type:** `std::optional<std::chrono::nanoseconds>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L135

### stale_while_revalidate

**Type:** `std::optional<std::chrono::nanoseconds>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L136

### surrogate_keys

**Type:** `std::optional<std::string>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L137

### length

**Type:** `std::optional<std::uint64_t>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L138

### user_metadata

**Type:** `std::optional<std::vector<std::uint8_t>>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L139

### sensitive_data

**Type:** `bool`  
**Default:** `= false`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L140

### edge_max_age

**Type:** `std::optional<std::chrono::nanoseconds>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L141

### service

**Type:** `std::optional<std::string>`  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L142
