MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / fetch_with_cache

Method fetch_with_cache

flow-rs/src/node/port.rs:171–180  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

169 }
170
171 pub async fn fetch_with_cache(&mut self) -> &mut HashMap<u64, Receiver> {
172 if self.cache.is_empty() {
173 if let Ok((k, v)) = self.fetch().await {
174 self.cache.insert(k, v);
175 }
176 } else if let Some((k, v)) = self.try_fetch() {
177 self.cache.insert(k, v);
178 }
179 &mut self.cache
180 }
181
182 pub fn cache(&self) -> &HashMap<u64, Receiver> {
183 &self.cache

Callers 1

execMethod · 0.80

Calls 4

insertMethod · 0.80
is_emptyMethod · 0.45
fetchMethod · 0.45
try_fetchMethod · 0.45

Tested by

no test coverage detected