()
| 10 | |
| 11 | |
| 12 | def clear_cache(): |
| 13 | while True: |
| 14 | now = time.time() |
| 15 | |
| 16 | for filename in os.listdir(cache_dir): |
| 17 | filepath = os.path.join(cache_dir, filename) |
| 18 | if os.path.isfile(filepath): |
| 19 | file_creation_time = os.path.getctime(filepath) |
| 20 | |
| 21 | if config.cache_cleanup_time is None: |
| 22 | raise ValueError("cache_cleanup_time is not initialized properly.") |
| 23 | |
| 24 | if now - file_creation_time > config.cache_cleanup_time: |
| 25 | os.remove(filepath) |
| 26 | time.sleep(60) |
| 27 | |
| 28 | |
| 29 | def start_cache_daemon(): |
nothing calls this directly
no outgoing calls
no test coverage detected