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

**Kind:** Struct  
**Module:** [simple](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/cache/simple/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/cache/simple.rs#132

```rust
pub struct CacheEntry {
    pub value: Body,
    pub ttl: Duration,
}
```

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

## Fields

### value

**Type:** `crate::Body`

The value to cache.

#### Argument type conversion

See the `From` impls for [`Body`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/http/body/struct.Body/) to see which types can be used as a body.

### ttl

**Type:** `std::time::Duration`

The time-to-live for the cache entry.

## Trait implementations

### impl Debug for CacheEntry

#### fmt

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/cache/simple.rs#131

```rust
fn fmt(&self, f: &mut Formatter<'_>) -> Result
```

**Parameters**

- `self`: `&Self`
- `f`: `&mut $crate::fmt::Formatter`

**Returns**

`$crate::fmt::Result`

## Auto trait implementations

- `Freeze`
- `RefUnwindSafe`
- `Send`
- `Sync`
- `Unpin`
- `UnsafeUnpin`
- `UnwindSafe`

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `Downcast`
- `DowncastSync`
- `ErasedDestructor`
- `From<T>`
- `Into<U>`
- `IntoEither`
- `Same`
- `TryFrom<U>`
- `TryInto<U>`
