pub struct StaticDataCache {
pub securities: DashMap<String, CachedSecurityInfo>,
pub id_to_key: DashMap<u64, String>,
pub trade_dates: DashMap<String, Vec<CachedTradeDate>>,
pub plates: DashMap<String, Vec<CachedPlateInfo>>,
pub owner_to_warrants: RwLock<HashMap<u64, Vec<u64>>>,
}Expand description
静态数据缓存
Fields§
§securities: DashMap<String, CachedSecurityInfo>股票静态信息: “market_code” → info
id_to_key: DashMap<u64, String>stock_id → “market_code” key (反向映射,用于推送时查找)
trade_dates: DashMap<String, Vec<CachedTradeDate>>交易日: “market:year-month” → Vec
plates: DashMap<String, Vec<CachedPlateInfo>>板块: “market:plate_type” → Vec
owner_to_warrants: RwLock<HashMap<u64, Vec<u64>>>窝轮正股 owner_id → 该正股对应的所有窝轮 stock_id 列表 用于 GetReference(Warrant) 查询
Implementations§
Source§impl StaticDataCache
impl StaticDataCache
pub fn new() -> Self
pub fn set_security_info(&self, key: &str, info: CachedSecurityInfo)
pub fn get_security_info(&self, key: &str) -> Option<CachedSecurityInfo>
Sourcepub fn get_security_info_by_stock_id(
&self,
stock_id: u64,
) -> Option<CachedSecurityInfo>
pub fn get_security_info_by_stock_id( &self, stock_id: u64, ) -> Option<CachedSecurityInfo>
通过 stock_id 查找股票信息 (使用 id_to_key 反向映射)
Sourcepub fn add_warrant_owner(&self, warrant_stock_id: u64, owner_stock_id: u64)
pub fn add_warrant_owner(&self, warrant_stock_id: u64, owner_stock_id: u64)
添加窝轮→正股的映射关系
Sourcepub fn search_warrants_by_owner(&self, owner_stock_id: u64) -> Vec<u64>
pub fn search_warrants_by_owner(&self, owner_stock_id: u64) -> Vec<u64>
通过正股 ID 搜索该正股的所有窝轮
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StaticDataCache
impl !RefUnwindSafe for StaticDataCache
impl Send for StaticDataCache
impl Sync for StaticDataCache
impl Unpin for StaticDataCache
impl UnwindSafe for StaticDataCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more