This commit is contained in:
cursor[bot] 2026-08-27 19:27:26 -05:00 committed by GitHub
commit 3030e794e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View file

@ -246,7 +246,9 @@ async def _run_under_circuit_breaker(
return result
def _redis_circuit_breaker_guard(method):
def _redis_circuit_breaker_guard(
method: Callable[..., Awaitable[_RedisCallResult]],
) -> Callable[..., Awaitable[_RedisCallResult]]:
"""
Decorator for RedisCache async methods.
Checks the circuit breaker before each call; records success/failure after.
@ -260,7 +262,7 @@ def _redis_circuit_breaker_guard(method):
"""
@functools.wraps(method)
async def wrapper(self, *args, **kwargs):
async def wrapper(self: "RedisCache", *args: object, **kwargs: object) -> _RedisCallResult:
return await _run_under_circuit_breaker(
self._circuit_breaker, method.__name__, lambda: method(self, *args, **kwargs)
)

View file

@ -129,17 +129,17 @@ class UserApiKeyCache(DualCache):
return None
return decoded
def set_cache(self, key, value, local_only: bool = False, **kwargs):
def set_cache(self, key, value, local_only: bool = False, **kwargs: object):
model_type: Final = cast(type[BaseModel] | None, kwargs.pop("model_type", None))
payload: Final = CacheCodec.serialize(value, model_type=model_type)
return super().set_cache(key=key, value=payload, local_only=local_only, **kwargs)
async def async_set_cache(self, key, value, local_only: bool = False, **kwargs):
async def async_set_cache(self, key, value, local_only: bool = False, **kwargs: object):
model_type: Final = cast(type[BaseModel] | None, kwargs.pop("model_type", None))
payload: Final = CacheCodec.serialize(value, model_type=model_type)
return await super().async_set_cache(key=key, value=payload, local_only=local_only, **kwargs)
async def async_set_cache_pipeline(self, cache_list: list, local_only: bool = False, **kwargs) -> None:
async def async_set_cache_pipeline(self, cache_list: list, local_only: bool = False, **kwargs: object) -> None:
"""
Batch writes with the same Codec boundary as ``async_set_cache`` without
``model_type``: ``BaseModel`` values become JSON-safe dicts; dicts/scalars unchanged.