Finalize user-engine contracts and operability

This commit is contained in:
tegwick 2026-05-22 21:45:30 +02:00
parent b81a9e05da
commit ce2d620f4e
12 changed files with 392 additions and 15 deletions

View file

@ -8,6 +8,14 @@ from user_engine.domain import Actor, ProjectionType
from user_engine.service import Projection, UserEngineService
@dataclass
class CacheStatus:
entries: int
tenants: tuple[str, ...]
applications: tuple[str, ...]
users: tuple[str, ...]
@dataclass
class ClaimsEnrichmentProjectionCache:
"""Cache claims-enrichment projections for external token adapters.
@ -47,3 +55,11 @@ class ClaimsEnrichmentProjectionCache:
for key in tuple(self._cache):
if key[2] == user_id:
del self._cache[key]
def status(self) -> CacheStatus:
return CacheStatus(
entries=len(self._cache),
tenants=tuple(sorted({key[0] for key in self._cache})),
applications=tuple(sorted({key[1] for key in self._cache})),
users=tuple(sorted({key[2] for key in self._cache})),
)