---
title: CacheError
summary: Errors arising from cache operations.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/cache/simple/enum.CacheError/
---

**Kind:** Enum  
**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#36

```rust
#[non_exhaustive]
pub enum CacheError {
    LimitExceeded,
    InvalidOperation,
    Unsupported,
    Timeout,
    Io(Error),
    Purge(Error),
    GetOrSet(Error),
    Other(FastlyStatus),
}
```

Errors arising from cache operations.

## Variants

### LimitExceeded

Operation failed due to a limit.

### InvalidOperation

An underlying Core Cache API operation found an invalid state.

This should not arise during use of this API. If encountered, please report it as a bug.

### Unsupported

Cache operation is not supported.

### Timeout

A cache operation did not complete within its timeout.

### Io

- `0`: `std::io::Error`

An IO error occurred during an operation.

### Purge

- `0`: `crate::Error`

An error occurred when purging a value.

### GetOrSet

- `0`: `anyhow::Error`

An error occurred while running the closure argument of [`get_or_set()`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/cache/simple/fn.get_or_set/).

This uses [`anyhow::Error`](https://docs.rs/anyhow/1.0.100/anyhow/struct.Error.html) to provide maximum flexibility in how the closure reports errors.

### Other

- `0`: `fastly_shared::FastlyStatus`

An unknown error occurred.

## Trait implementations

### impl Debug for CacheError

#### fmt

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

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

**Parameters**

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

**Returns**

`$crate::fmt::Result`

### impl Display for CacheError

#### fmt

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

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

**Parameters**

- `self`: `&Self`
- `__formatter`: `&mut ::core::fmt::Formatter`

**Returns**

`::core::fmt::Result`

### impl Error for CacheError

#### source

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

```rust
fn source(&self) -> Option<&(dyn Error + 'static)>
```

**Parameters**

- `self`: `&Self`

**Returns**

`::core::option::Option<&(dyn Error + 'static)>`

### impl From<CacheError> for CacheError

#### from

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

```rust
fn from(value: CacheError) -> Self
```

**Parameters**

- `value`: `core::CacheError`

**Returns**

`Self`

### impl From<Error> for CacheError

#### from

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

```rust
fn from(source: Error) -> Self
```

**Parameters**

- `source`: `std::io::Error`

**Returns**

`Self`

## 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`
- `ToString`
- `TryFrom<U>`
- `TryInto<U>`
