feat: add shared fund quote capability

This commit is contained in:
2026-09-09 23:40:35 +08:00
parent ca680ca46f
commit 46fc976b24
22 changed files with 1561 additions and 8 deletions
+22
View File
@@ -0,0 +1,22 @@
"""基金行情短缓存适配器。缓存失败只影响性能,不阻塞外部行情查询。"""
from typing import Protocol
from app.infrastructure.memory_cache import CacheReadResult
class FundQuoteCacheClient(Protocol):
async def get(self, key: str) -> CacheReadResult: ...
async def set(self, key: str, value: str, ttl_seconds: int) -> bool: ...
class FundQuoteCache:
def __init__(self, client: FundQuoteCacheClient) -> None:
self.client = client
async def get(self, key: str) -> CacheReadResult:
return await self.client.get(key)
async def set(self, key: str, value: str, ttl_seconds: int) -> bool:
return await self.client.set(key, value, ttl_seconds)