Add disk-backed SQLite cache mode as an alternative to in-memory
This commit is contained in:
+11
-2
@@ -8,7 +8,12 @@ from sqlalchemy import inspect
|
||||
from sqlalchemy.engine import Engine
|
||||
|
||||
from .cache import CacheManager
|
||||
from .config import BACKUP_INTERVAL_SECONDS, CACHE_DB_PATH, REFRESH_INTERVAL_SECONDS
|
||||
from .config import (
|
||||
BACKUP_INTERVAL_SECONDS,
|
||||
CACHE_DB_PATH,
|
||||
IN_MEMORY,
|
||||
REFRESH_INTERVAL_SECONDS,
|
||||
)
|
||||
from .delta import DeltaConfig, DeltaRefresher, ResolvedDelta
|
||||
from .executor import QueryExecutor
|
||||
from .parser import Params, parse
|
||||
@@ -25,9 +30,13 @@ class CachingEngine:
|
||||
delta: dict[str, DeltaConfig] | None = None,
|
||||
ttl: dict[str, int] | None = None,
|
||||
indexes: dict[str, list[str | list[str]]] | None = None,
|
||||
in_memory: bool | None = None,
|
||||
) -> None:
|
||||
self._source_engine = source_engine
|
||||
self._cache = CacheManager(CACHE_DB_PATH, BACKUP_INTERVAL_SECONDS)
|
||||
use_memory = IN_MEMORY if in_memory is None else in_memory
|
||||
self._cache = CacheManager(
|
||||
CACHE_DB_PATH, BACKUP_INTERVAL_SECONDS, in_memory=use_memory
|
||||
)
|
||||
self._registry = ColumnRegistry(self._cache.connection)
|
||||
self._stats = StatsCollector()
|
||||
self._refresh_interval = REFRESH_INTERVAL_SECONDS
|
||||
|
||||
Reference in New Issue
Block a user