cache.py
545 Bytes
from typing import Optional, Protocol
class SkillCache(Protocol):
def get(self, skill_code: str) -> Optional[str]:
...
def set(self, skill_code: str, value: str, expire_seconds: int = 3600) -> None:
...
class InMemorySkillCache:
def __init__(self):
self._store: dict[str, str] = {}
def get(self, skill_code: str) -> Optional[str]:
return self._store.get(skill_code)
def set(self, skill_code: str, value: str, expire_seconds: int = 3600) -> None:
self._store[skill_code] = value