(standard: bool=False)
| 492 | |
| 493 | |
| 494 | def purge(standard: bool=False): |
| 495 | if Cache.DISABLE_CACHE: |
| 496 | return |
| 497 | |
| 498 | mode = config.get_cache_mode() |
| 499 | if mode not in ("ask", "auto", "always"): |
| 500 | raise ValueError(f"Cache mode has invalid value in the configuration: '{mode}'") |
| 501 | |
| 502 | if mode == "ask" and standard: |
| 503 | if click.confirm("Would you like to purge the cache?"): |
| 504 | CacheItem.cleanup() |
| 505 | elif (mode == "auto" and standard) or mode == "always": |
| 506 | CacheItem.cleanup() |
| 507 | |
| 508 | |
| 509 | def get_expiration(category: str="default") -> datetime.timedelta: |
no test coverage detected