Initialize cache. Args: cache_path: Path to DuckDB file (None to disable) rewrite: If True, ignore cached values but still write new ones
(self, cache_path: str = "task_cache.duckdb", rewrite: bool = False)
| 43 | """ |
| 44 | |
| 45 | def __init__(self, cache_path: str = "task_cache.duckdb", rewrite: bool = False): |
| 46 | """Initialize cache. |
| 47 | |
| 48 | Args: |
| 49 | cache_path: Path to DuckDB file (None to disable) |
| 50 | rewrite: If True, ignore cached values but still write new ones |
| 51 | """ |
| 52 | self.cache_path = cache_path |
| 53 | self.enabled = cache_path is not None |
| 54 | self.rewrite = rewrite |
| 55 | self._local = threading.local() |
| 56 | self._lock = threading.Lock() |
| 57 | if self.enabled: |
| 58 | self._init_db() |
| 59 | |
| 60 | def _get_conn(self): |
| 61 | """Get thread-local connection.""" |