"""Cache protocol — structural subtyping for ephemeral caches."""

from typing import Any, Optional, Protocol, runtime_checkable


@runtime_checkable
class CacheProtocol(Protocol):
    async def get(self, key: str) -> Optional[Any]: ...
    async def set(self, key: str, value: Any, ttl_seconds: int = 60) -> None: ...
    async def delete(self, key: str) -> None: ...
    async def clear(self) -> None: ...
    async def clear_prefix(self, prefix: str) -> int: ...
    async def cleanup_expired(self) -> int: ...
    def size(self) -> int: ...
    def estimate_memory_bytes(self) -> int: ...
