mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-11-29 02:59:08 +00:00
inline probe_memoized_value
This commit is contained in:
parent
485df37e6f
commit
4cae741768
1 changed files with 18 additions and 27 deletions
|
@ -340,9 +340,19 @@ where
|
|||
}
|
||||
|
||||
QueryState::Memoized(memo) => {
|
||||
debug!("{:?}: found memoized value", self);
|
||||
debug!(
|
||||
"{:?}: found memoized value, verified_at={:?}, changed_at={:?}",
|
||||
self, memo.verified_at, memo.changed_at,
|
||||
);
|
||||
|
||||
if let Some(value) = &memo.value {
|
||||
if memo.verified_at == revision_now {
|
||||
let value = StampedValue {
|
||||
durability: memo.durability,
|
||||
changed_at: memo.changed_at,
|
||||
value: value.clone(),
|
||||
};
|
||||
|
||||
if let Some(value) = memo.probe_memoized_value(revision_now) {
|
||||
info!(
|
||||
"{:?}: returning memoized value changed at {:?}",
|
||||
self, value.changed_at
|
||||
|
@ -352,6 +362,7 @@ where
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProbeState::StaleOrAbsent(state)
|
||||
}
|
||||
|
@ -710,26 +721,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the memoized value *if* it is known to be update in the given revision.
|
||||
fn probe_memoized_value(&self, revision_now: Revision) -> Option<StampedValue<Q::Value>> {
|
||||
let value = self.value.as_ref()?;
|
||||
|
||||
debug!(
|
||||
"probe_memoized_value(verified_at={:?}, changed_at={:?})",
|
||||
self.verified_at, self.changed_at,
|
||||
);
|
||||
|
||||
if self.verified_at == revision_now {
|
||||
return Some(StampedValue {
|
||||
durability: self.durability,
|
||||
changed_at: self.changed_at,
|
||||
value: value.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn has_untracked_input(&self) -> bool {
|
||||
match self.inputs {
|
||||
MemoInputs::Untracked => true,
|
||||
|
|
Loading…
Reference in a new issue