Coverage for session_buddy / tools / history_cache.py: 100.00%
7 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-04 00:43 -0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-04 00:43 -0800
1"""Caching layer for history analysis to improve performance.
3This module now uses ACB-backed cache for improved performance and
4lifecycle management while maintaining backwards-compatible API.
5"""
7from session_buddy.acb_cache_adapter import ACBHistoryCache, get_history_cache
9# Backwards-compatible alias
10HistoryAnalysisCache = ACBHistoryCache
13def get_cache(ttl: float = 300.0) -> ACBHistoryCache:
14 """Get or create global cache instance.
16 Args:
17 ttl: Time-to-live in seconds (default: 5 minutes)
19 Returns:
20 Global cache instance using ACB-backed implementation
22 """
23 return get_history_cache(ttl=ttl)
26async def reset_cache() -> None:
27 """Reset global cache instance.
29 Useful for testing or clearing all cached data.
30 """
31 from session_buddy.acb_cache_adapter import reset_caches
33 await reset_caches()