ausecon-mcp-server 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ """ausecon-mcp-server package."""
ausecon_mcp/cache.py ADDED
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from time import monotonic
5
+ from typing import Any
6
+
7
+
8
+ @dataclass
9
+ class _CacheEntry:
10
+ expires_at: float
11
+ value: Any
12
+
13
+
14
+ class TTLCache:
15
+ def __init__(self) -> None:
16
+ self._entries: dict[str, _CacheEntry] = {}
17
+
18
+ def get(self, key: str) -> Any | None:
19
+ entry = self._entries.get(key)
20
+ if entry is None:
21
+ return None
22
+ if entry.expires_at < monotonic():
23
+ self._entries.pop(key, None)
24
+ return None
25
+ return entry.value
26
+
27
+ def set(self, key: str, value: Any, ttl_seconds: int) -> Any:
28
+ self._entries[key] = _CacheEntry(expires_at=monotonic() + ttl_seconds, value=value)
29
+ return value
@@ -0,0 +1 @@
1
+ """Curated catalogue metadata for ABS and RBA datasets."""