Something went wrong. Try again.
Retro Bulletin Board Systems on atproto. Web app and TUI.
lazy mirror of [alyraffauf/atbbs](https://github.com/alyraffauf/atbbs) atbbs.xyz
forums python tui atproto bbs
Something went wrong. Try again.
1234567891011121314151617181920212223242526"""Simple in-memory cache with TTL."""
import time
class TTLCache: def __init__(self, ttl_seconds: float): self._ttl = ttl_seconds self._entries: dict[str, tuple[object, float]] = {}
def get(self, key: str): entry = self._entries.get(key) if entry is None: return None value, expires = entry if time.monotonic() > expires: del self._entries[key] return None return value
def set(self, key: str, value): self._entries[key] = (value, time.monotonic() + self._ttl)
def clear(self): self._entries.clear()