# IntermediateCache

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-dynamic-data/cache/struct-intermediatecache/

**struct** · [`ferroui-dynamic-data`](/docs/0.5.0/api/ferroui-dynamic-data/) · v0.5.0

```rust
struct IntermediateCache<T, K>
```

A cache without a key selector, whose edits give the keys (`IntermediateCache<TObject,
TKey>`): the cache of the operators that keep items under keys of their own. A clone is a
handle to the same cache.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L20)

## Members

- [`new`](#function-new)
- [`from_source`](#function-from_source)
- [`edit`](#function-edit)
- [`suspend_count`](#function-suspend_count)
- [`suspend_notifications`](#function-suspend_notifications)
- [`add_or_update`](#function-add_or_update)
- [`clear`](#function-clear)
- [`remove_key`](#function-remove_key)
- [`remove_keys`](#function-remove_keys)

<a id="function-new"></a>

### new

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

An empty cache (`IntermediateCache()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L38)

<a id="function-from_source"></a>

### from_source

```rust
fn from_source<C: IChangeSet<T, K>>(source: Rc<dyn IObservable<C>>) -> Self
```

A cache that applies the change sets of `source` (`IntermediateCache(IObservable<IChangeSet>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L43)

<a id="function-edit"></a>

### edit

```rust
fn edit(self: &Self, update: impl FnOnce(&mut dyn ICacheUpdater<T, K>) -> ())
```

Runs an edit (`Edit(Action<ICacheUpdater>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L48)

<a id="function-suspend_count"></a>

### suspend_count

```rust
fn suspend_count(self: &Self) -> Rc<dyn IDisposable>
```

Holds back the notifications of count changes until the result is disposed (`SuspendCount`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L53)

<a id="function-suspend_notifications"></a>

### suspend_notifications

```rust
fn suspend_notifications(self: &Self) -> Rc<dyn IDisposable>
```

Holds back the notifications of changes until the result is disposed
(`SuspendNotifications`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L59)

<a id="function-add_or_update"></a>

### add_or_update

```rust
fn add_or_update(self: &Self, item: T, key: K)
```

Adds `item` under `key`, or replaces the item of `key` (`AddOrUpdate(IIntermediateCache,
TObject, TKey)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L65)

<a id="function-clear"></a>

### clear

```rust
fn clear(self: &Self)
```

Removes every item (`Clear(IIntermediateCache)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L70)

<a id="function-remove_key"></a>

### remove_key

```rust
fn remove_key(self: &Self, key: K)
```

Removes the item of `key` (`Remove(IIntermediateCache, TKey)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L75)

<a id="function-remove_keys"></a>

### remove_keys

```rust
fn remove_keys(self: &Self, keys: impl IntoIterator<Item = K>)
```

Removes the items of `keys` (`Remove(IIntermediateCache, IEnumerable<TKey>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/intermediate_cache.rs#L80)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`SourceCacheEx<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-sourcecacheex/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Clone`
- `Default`
- [`IConnectableCache<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-iconnectablecache/)
- [`IObservableCache<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-iobservablecache/)
- [`IIntermediateCache<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-iintermediatecache/)
- [`IDisposable`](/docs/0.5.0/api/ferroui-base/reactive/use-idisposable/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
