Graph Cache Manager¶
graph_cache_manager ¶
Graph Cache Manager - Graph Caching Interface.
Provides manager interface compatible with PlotService for graph caching operations.
Classes:
| Name | Description |
|---|---|
GraphCacheManager | Manager wrapper for GraphCache with metadata support |
Classes¶
GraphCacheManager ¶
Manager for graph caching operations.
Wraps GraphCache with additional management capabilities and metadata support.
Attributes:
| Name | Type | Description |
|---|---|---|
cache | GraphCache | Underlying cache instance |
Methods:
| Name | Description |
|---|---|
cache_graph | Cache a Plotly figure |
get_cached_graph | Retrieve cached Plotly figure |
clear | Clear all cached graphs |
get_stats | Get cache statistics |
Initialize graph cache manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_size | int | Maximum number of graphs to cache. | 100 |
default_ttl | int | Default TTL in seconds (1 hour). | 3600 |
Source code in src/infrastructure/cache/graph_cache_manager.py
Functions¶
cache_graph ¶
cache_graph(key: str, figure: Figure, metadata: Optional[dict] = None, ttl: Optional[int] = None) -> None
Cache a Plotly figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key | str | Cache key | required |
figure | Figure | Plotly figure to cache | required |
metadata | Optional[dict] | Optional metadata (for logging/tracking) | None |
ttl | Optional[int] | TTL in seconds (if None, uses default) | None |
Source code in src/infrastructure/cache/graph_cache_manager.py
get_cached_graph ¶
Retrieve cached Plotly figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key | str | Cache key | required |
Returns:
| Type | Description |
|---|---|
Optional[Figure] | Cached figure or None if not found |
Source code in src/infrastructure/cache/graph_cache_manager.py
clear ¶
get_stats ¶
Get cache statistics.
Returns:
| Type | Description |
|---|---|
dict | Statistics including size, max_size, etc. |