---
title: ReplaceStrategy
summary: Strategy to use to replace the existing object
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/cache/core/enum.ReplaceStrategy/
---

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

```rust
pub enum ReplaceStrategy {
    Immediate,
    ImmediateForceMiss,
    Wait,
}
```

Strategy to use to replace the existing object

## Variants

### Immediate

Immediately start the replace and do not wait for any other pending requests for the same
object, including insert requests.

With this strategy a replace will race all other pending requests to update the object.

The existing object will be accessible until this replace finishes providing the
replacement object.

This is the default replace strategy.

### ImmediateForceMiss

Immediate, but remove the existing object immediately

Requests for the same object that arrive after this replace starts will wait until this
replace starts providing the replacement object.

### Wait

Join the wait list behind other pending requests before starting this request.

With this strategy this replace request will wait for an in-progress replace or insert
request before starting.

This strategy allows implementing a counter, but may cause timeouts if too many requests
are waiting for in-progress and waiting updates to complete.

## Trait implementations

### impl Clone for ReplaceStrategy

#### clone

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/cache/core/replace.rs#16

```rust
fn clone(&self) -> Self
```

**Parameters**

- `self`: `&Self`

**Returns**

`Self`

### impl Debug for ReplaceStrategy

#### fmt

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/cache/core/replace.rs#16

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

**Parameters**

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

**Returns**

`$crate::fmt::Result`

### impl Default for ReplaceStrategy

#### default

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/cache/core/replace.rs#16

```rust
fn default() -> Self
```

**Returns**

`Self`

## Auto trait implementations

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

## Blanket implementations

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