(url: str)
| 304 | |
| 305 | |
| 306 | def _cache_get(url: str) -> tuple[str, str, int] | None: |
| 307 | entry = _url_cache.get(url) |
| 308 | if entry is None: |
| 309 | return None |
| 310 | ts, content, content_type, status = entry |
| 311 | if time.time() - ts > _CACHE_TTL: |
| 312 | del _url_cache[url] |
| 313 | return None |
| 314 | return content, content_type, status |
| 315 | |
| 316 | |
| 317 | def _cache_set(url: str, content: str, content_type: str, status: int) -> None: |