---
title: get
summary: Get the entry associated with the given cache key, if it exists.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/cache/simple/fn.get/
---

**Kind:** Function  
**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#92

```rust
fn get(key: impl Into<CacheKey>) -> Result<Option<Body>, CacheError>
```

Get the entry associated with the given cache key, if it exists.

```rust
if let Some(value) = get("my_key")? {
    let cached_string = value.into_string();
    println!("the cached string was: {cached_string}");
}
```

#### Argument type conversion

See the `From` impls for [`Bytes`](https://docs.rs/bytes/latest/bytes/bytes/struct.Bytes.html) to see which types can be used
as a key.

**Parameters**

- `key`: `impl Into<CacheKey>`

**Returns**

`Result<Option<crate::Body>, CacheError>`
