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

# Cache and Sync Tools

> Inspect cache health, optimize hit rates, and check background sync status for r3 memory operations.

r3 caches memories in two tiers and processes writes asynchronously by default. These tools let you inspect cache health, tune what stays hot, and confirm that async writes have finished. See [Memory Tools](/r3/memory-tools) for storing and retrieving memories.

## cache\_stats

View cache performance metrics and health status. Use for monitoring and debugging.

**Returns:** Summary text with cached memory count.

## optimize\_cache

Reorganize cache for optimal hit rates. Promotes frequently accessed memories to L1 (24h TTL) and demotes cold data to L2 (7d TTL).

<ResponseField name="force_refresh" type="boolean">
  `true` clears cache and reloads all from storage. `false` optimizes existing cache. Default: `false`.
</ResponseField>

<ResponseField name="max_memories" type="number">
  Maximum memories to keep in cache. Range: 100-10000. Default: 1000.
</ResponseField>

**Returns:** Summary of cached memories.

## sync\_status

Check the background job queue and sync status. Shows pending async operations from `add_memory` calls.

**Returns:** Count of pending operations, or `All operations complete`.

## Related

<Columns cols={2}>
  <Card title="Memory Tools" href="/r3/memory-tools">
    Store, retrieve, search, and manage memories.
  </Card>

  <Card title="Configuration" href="/r3/configuration">
    Set storage backends and cache priorities.
  </Card>
</Columns>
