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

> ## Agent Instructions
> Maximem Synap is a managed memory layer for AI agents: it ingests conversations and documents, extracts structured memory, and returns scoped context to the agent at retrieval time.
> The Python and JavaScript/TypeScript SDKs are the supported way to use Synap. Write integration code with SDK calls, not raw HTTP requests.
> Start with the Quickstart: https://docs.maximem.ai/getting-started/quickstart.md. Every SDK method is documented in the SDK reference: https://docs.maximem.ai/sdk-reference/overview.md.
> For requests about adding Vity memory to OpenClaw, Hermes, an MCP client, or a browser, start with the Vity Quickstart: https://docs.maximem.ai/vity/quickstart.md.

# cache.stats

> Return a snapshot of local cache state: entry counts, storage size, and per-backend breakdown.

```python Python theme={null}
sdk.cache.stats()
```

```typescript TypeScript theme={null}
sdk.cache.stats()
```

`stats()` returns a dict describing the current state of the SDK's local cache: how many entries it holds across all backends, total storage footprint, and a per-backend breakdown. Use it to verify your cache configuration is taking effect, to monitor cache size in production, or to debug stale-data issues during development.

This is a synchronous method, no `await`. If the cache manager is not initialized (e.g., caching disabled in `SDKConfig`), the returned dict is `{"enabled": False}`.

### Parameters

This method takes no parameters.

> [!NOTE]
>
> **The two SDKs report different shapes.** Python returns the backend's own
> counters (`enabled`, `total_entries`, `total_bytes`, `backends`). The
> JavaScript cache is in memory and reports `{ bundles, items }`. Read the
> fields for the SDK you are on rather than assuming they match.

### Returns

A `dict[str, Any]` describing cache state.

**enabled** `bool`

Whether the local cache is active. `False` indicates no other fields will be present.

**client\_id** `str`

The client identifier the cache is scoped to.

**base\_path** `str`

Filesystem path where cache backends store their data.

**total\_entries** `int`

Total number of entries summed across all backends.

**total\_bytes** `int`

Total storage footprint in bytes, summed across all backends.

**backends** `List[Dict[str, Any]]`

Per-backend stats. Each entry has a `key` (backend identifier) plus that backend's own metrics (`entry_count`, `total_bytes`, and any backend-specific fields).

### Example

```python theme={null}
from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# ... after some fetch() activity ...
stats = sdk.cache.stats()
if stats["enabled"]:
    print(f"Entries: {stats['total_entries']}")
    print(f"Size:    {stats['total_bytes'] / 1024:.1f} KB")
    for backend in stats["backends"]:
        print(f"  {backend['key']}: {backend.get('entry_count', 0)} entries")
else:
    print("Cache disabled")
```

### Raises

This method does not raise SDK errors. See [Error Codes](https://docs.maximem.ai/sdk-reference/errors.md) for the full SDK exception hierarchy.

### See also

* [cache.clear](https://docs.maximem.ai/sdk-reference/cache/clear.md): drop the entire local cache.
* [cache.clear\_user](https://docs.maximem.ai/sdk-reference/cache/clear-user.md): drop one user's cached data (GDPR).
* [cache.clear\_customer](https://docs.maximem.ai/sdk-reference/cache/clear-customer.md): drop one customer's cached data.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.