---
title: CacheEntry
summary: The return type of the closure provided to getorset_with().
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/simple/class.CacheEntry/
---

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

Include `fastly/cache/simple.h` to use this class.

The return type of the closure provided to [get_or_set_with()](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/simple/fn.get_or_set_with/).

## Constructor

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

```cpp
fastly::cache::simple::CacheEntry::CacheEntry(http::Body val, std::chrono::nanoseconds ttl)
```

**Parameters**

- `val`: `http::Body`
- `ttl`: `std::chrono::nanoseconds`

## Methods

### ttl

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

```cpp
std::chrono::nanoseconds fastly::cache::simple::CacheEntry::ttl() const
```

**Returns**

`std::chrono::nanoseconds`

### value

_Overload 1 of 2_

```cpp
http::Body & fastly::cache::simple::CacheEntry::value()
```

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

**Returns**

`http::Body &`

_Overload 2 of 2_

```cpp
const http::Body & fastly::cache::simple::CacheEntry::value() const
```

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

**Returns**

`const http::Body &`
