mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-02 22:01:05 +02:00
31 lines
837 B
Python
31 lines
837 B
Python
|
|
"""Index-cache configuration resolved from the central ``Config``.
|
||
|
|
|
||
|
|
The blob backend is intentionally not configured here: it is shared with the ETL
|
||
|
|
parse cache (see ``ETL_CACHE_STORAGE_*``).
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from dataclasses import dataclass
|
||
|
|
|
||
|
|
|
||
|
|
@dataclass(frozen=True)
|
||
|
|
class IndexCacheSettings:
|
||
|
|
enabled: bool
|
||
|
|
chunker_version: int
|
||
|
|
ttl_days: int
|
||
|
|
max_total_bytes: int
|
||
|
|
eviction_batch: int
|
||
|
|
|
||
|
|
|
||
|
|
def load_index_cache_settings() -> IndexCacheSettings:
|
||
|
|
from app.config import config
|
||
|
|
|
||
|
|
return IndexCacheSettings(
|
||
|
|
enabled=config.INDEX_CACHE_ENABLED,
|
||
|
|
chunker_version=config.INDEX_CACHE_CHUNKER_VERSION,
|
||
|
|
ttl_days=config.INDEX_CACHE_TTL_DAYS,
|
||
|
|
max_total_bytes=config.INDEX_CACHE_MAX_TOTAL_MB * 1024 * 1024,
|
||
|
|
eviction_batch=config.INDEX_CACHE_EVICTION_BATCH,
|
||
|
|
)
|