Skip to main content

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.

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.

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

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 for the full SDK exception hierarchy.

See also