|
33 | 33 |
|
34 | 34 | from rocrate_validator.utils import log as logging |
35 | 35 | from rocrate_validator import __version__ |
36 | | -from rocrate_validator.constants import (DEFAULT_ONTOLOGY_FILE, |
| 36 | +from rocrate_validator.constants import (DEFAULT_HTTP_CACHE_MAX_AGE, |
| 37 | + DEFAULT_ONTOLOGY_FILE, |
37 | 38 | DEFAULT_PROFILE_IDENTIFIER, |
38 | 39 | DEFAULT_PROFILE_README_FILE, |
39 | 40 | IGNORED_PROFILE_DIRECTORIES, |
@@ -2388,11 +2389,21 @@ class ValidationSettings: |
2388 | 2389 | metadata_dict: dict = None |
2389 | 2390 | #: Verbose output |
2390 | 2391 | verbose: bool = False |
| 2392 | + #: Cache max age in seconds |
| 2393 | + cache_max_age: Optional[int] = DEFAULT_HTTP_CACHE_MAX_AGE |
| 2394 | + #: Cache path |
| 2395 | + cache_path: Optional[Path] = None |
2391 | 2396 |
|
2392 | 2397 | def __post_init__(self): |
2393 | 2398 | # if requirement_severity is a str, convert to Severity |
2394 | 2399 | if isinstance(self.requirement_severity, str): |
2395 | 2400 | self.requirement_severity = Severity[self.requirement_severity] |
| 2401 | + # initialize the HTTP cache |
| 2402 | + from rocrate_validator.utils import HttpRequester |
| 2403 | + # HttpRequester.initialize_cache(cache_path=self.cache_path, cache_max_age=self.cache_max_age) |
| 2404 | + HttpRequester.initialize_cache(cache_path=self.cache_path, cache_max_age=self.cache_max_age) |
| 2405 | + logger.debug("HTTP cache initialized at %s with max age %s seconds", |
| 2406 | + self.cache_path, self.cache_max_age) |
2396 | 2407 |
|
2397 | 2408 | def to_dict(self): |
2398 | 2409 | """ |
|
0 commit comments