Coverage for src / lexigram / contracts / admin / cache_provider.py: 100%
5 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:58 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:58 +0800
1"""CacheProviderProtocol — admin-side cache facade."""
3from __future__ import annotations
5from typing import Any, Protocol, runtime_checkable
8@runtime_checkable
9class CacheProviderProtocol(Protocol):
10 """Protocol for admin data-layer cache providers.
12 Provides basic get/set/delete/invalidate operations with TTL and tag
13 support. Tags are used for grouped invalidation.
15 This is the admin-internal cache abstraction, distinct from
16 ``lexigram.contracts.cache.CacheBackend`` which is the framework-wide
17 Redis/memory cache contract.
18 """
20 async def get(self, key: str) -> Any | None: ...
22 async def set(
23 self,
24 key: str,
25 value: Any,
26 ttl: int = 300,
27 tags: list[str] | None = None,
28 ) -> None: ...
30 async def delete(self, key: str) -> None: ...
32 async def invalidate_tags(self, tags: list[str]) -> None: ...
35__all__ = ["CacheProviderProtocol"]