> ## Documentation Index
> Fetch the complete documentation index at: https://private-04b27de1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.cache.in_memory_cache.InMemoryCache

<h2 id="autogen.cache.in_memory_cache.InMemoryCache" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">InMemoryCache</span>
</h2>

```python theme={null}
InMemoryCache(seed: str | int = '')
```

This protocol defines the basic interface for cache operations.<br />Implementing classes should provide concrete implementations for
these methods to handle caching mechanisms.

<b>Parameters:</b>

| Name   | Description                                     |
| ------ | ----------------------------------------------- |
| `seed` | **Type:** str \| int<br /><br />**Default:** '' |

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### close

```python theme={null}
close(self) -> None
```

Close the cache. Perform any necessary cleanup, such as closing network connections or
releasing resources.

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### get

```python theme={null}
get(
    self,
    key: str,
    default: Any | None = None
) -> Any | None
```

Retrieve an item from the cache.<br />

<b>Parameters:</b>

| Name      | Description                                                                                                                                     |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `key`     | The key identifying the item in the cache.<br /><br />**Type:** str                                                                             |
| `default` | The default value to return if the key is not found.<br /><br />Defaults to None.<br /><br />**Type:** Any \| None<br /><br />**Default:** None |

<b>Returns:</b>

| Type        | Description                                                         |
| ----------- | ------------------------------------------------------------------- |
| Any \| None | The value associated with the key if found, else the default value. |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### set

```python theme={null}
set(
    self,
    key: str,
    value: Any
) -> None
```

Set an item in the cache.<br />

<b>Parameters:</b>

| Name    | Description                                                            |
| ------- | ---------------------------------------------------------------------- |
| `key`   | The key under which the item is to be stored.<br /><br />**Type:** str |
| `value` | The value to be stored in the cache.<br /><br />**Type:** Any          |

<br />
