Check if platform resolution is cached and still valid.
(self, platform_name: str)
| 1529 | return packages |
| 1530 | |
| 1531 | def _is_platform_cached(self, platform_name: str) -> bool: |
| 1532 | """Check if platform resolution is cached and still valid.""" |
| 1533 | if not hasattr(self, "_platform_cache"): |
| 1534 | self._platform_cache: dict[str, PlatformResolution] = {} |
| 1535 | |
| 1536 | if platform_name not in self._platform_cache: |
| 1537 | return False |
| 1538 | |
| 1539 | resolution = self._platform_cache[platform_name] |
| 1540 | if not resolution.resolved_at: |
| 1541 | return False |
| 1542 | |
| 1543 | age = datetime.now() - resolution.resolved_at |
| 1544 | return age < timedelta(hours=resolution.ttl_hours) |
| 1545 | |
| 1546 | def _is_framework_cached(self, framework_name: str) -> bool: |
| 1547 | """Check if framework resolution is cached and still valid.""" |