Spaces:
Sleeping
Sleeping
File size: 1,052 Bytes
33340fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # Communication: `CacheClient`
**Code**: `adsp/communication/cache.py`
## Purpose
`CacheClient` provides a low-latency caching layer for frequently repeated computations (e.g., repeated persona answers for identical prompts).
## Responsibilities
- Store computed values by string key
- Retrieve cached values
## Public API
### `get(key: str) -> Any | None`
Returns the cached value if present; otherwise `None`.
### `set(key: str, value: Any) -> None`
Stores `value` under `key`.
## Data model
- `_entries: Dict[str, Any]` (in-memory)
## Current usage
Used by the Core orchestrator:
- `adsp/core/orchestrator/__init__.py` caches responses by `f"{persona_id}:{query}"`
## Key dependencies / technologies
- Python `dataclasses`
- In-memory `dict`
## Notes / production hardening
Replace the in-memory implementation with:
- Redis / Memcached
- Cache key strategy including:
- persona version / adapter version
- prompt template version
- retrieval context hash (to prevent stale grounding)
- TTLs and cache invalidation policies
|