> ## Documentation Index
> Fetch the complete documentation index at: https://www.getmaxim.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cache

> Cache utilities for caching mechanisms and utilities for optimizing performance.

[View module source on GitHub](https://github.com/maximhq/maxim-py/blob/main/maxim/cache/cache.py)

## [MaximCache](/sdk/python/references/cache/cache)

```python theme={null}
class MaximCache()
```

Abstract base class for caching implementations in [Maxim](/sdk/python/references/maxim).

This class defines the interface for cache operations including
getting, setting, deleting cache entries, and retrieving all keys.
Concrete implementations should inherit from this class and provide
actual storage mechanisms.

#### get\_all\_keys

```python theme={null}
def get_all_keys() -> List[str]
```

Retrieve all keys currently stored in the cache.

**Returns**:

| Name        | Description                                                    |
| ----------- | -------------------------------------------------------------- |
| `List[str]` | A list of all cache keys. Returns empty list if no keys exist. |

#### get

```python theme={null}
def get(key: str) -> Optional[str]
```

Retrieve a value from the cache by its key.

**Arguments**:

| Name  | Type  | Description               |
| ----- | ----- | ------------------------- |
| `key` | *str* | The cache key to look up. |

**Returns**:

| Name            | Description                                         |
| --------------- | --------------------------------------------------- |
| `Optional[str]` | The cached value if the key exists, None otherwise. |

#### set

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

Store a key-value pair in the cache.

**Arguments**:

| Name    | Type  | Description                             |
| ------- | ----- | --------------------------------------- |
| `key`   | *str* | The cache key to store the value under. |
| `value` | *str* | The value to cache.                     |

#### delete

```python theme={null}
def delete(key: str) -> None
```

Remove a key-value pair from the cache.

**Arguments**:

| Name  | Type  | Description              |
| ----- | ----- | ------------------------ |
| `key` | *str* | The cache key to remove. |
