(url: str, content: str, content_type: str, status: int)
| 315 | |
| 316 | |
| 317 | def _cache_set(url: str, content: str, content_type: str, status: int) -> None: |
| 318 | if len(_url_cache) >= _CACHE_MAX_SIZE: |
| 319 | oldest_key = min(_url_cache, key=lambda k: _url_cache[k][0]) |
| 320 | del _url_cache[oldest_key] |
| 321 | _url_cache[url] = (time.time(), content, content_type, status) |
| 322 | |
| 323 | |
| 324 | # -- Preapproved Domains ------------------------------------------------------ |