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.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
Adict[str, Any] describing cache state.
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
Raises
This method does not raise SDK errors. See Error Codes for the full SDK exception hierarchy.See also
- cache.clear: drop the entire local cache.
- cache.clear_user: drop one user’s cached data (GDPR).
- cache.clear_customer: drop one customer’s cached data.