1"""Caching layer for history analysis to improve performance.

2

3 This module now uses ACB-backed cache for improved performance and

4 lifecycle management while maintaining backwards-compatible API.

5"""

6

7 from session_buddy.acb_cache_adapter import ACBHistoryCache, get_history_cache

8

9# Backwards-compatible alias

10 HistoryAnalysisCache = ACBHistoryCache

11

12

13 def get_cache(ttl: float = 300.0) -> ACBHistoryCache:

14 """Get or create global cache instance.

15

16 Args:

17 ttl: Time-to-live in seconds (default: 5 minutes)

18

19 Returns:

20 Global cache instance using ACB-backed implementation

21

22 """

23 return get_history_cache(ttl=ttl)

24

25

26 async def reset_cache() -> None:

27 """Reset global cache instance.

28

29 Useful for testing or clearing all cached data.

30 """

31 from session_buddy.acb_cache_adapter import reset_caches

32

33 await reset_caches()