Add is_hit fn to RTCache CacheStatus

This commit is contained in:
Edward Wang 2024-06-18 19:05:56 -07:00 committed by Edward Wang
parent c0b23c6736
commit 6e83d51ab1
2 changed files with 9 additions and 1 deletions

2
.bleep
View file

@ -1 +1 @@
f87e46c90fe2f84c2ce90ac1def9f4400ae45f24
1fe0ed665dfcf6222a4d08f6120172be64d27eb9

View file

@ -45,6 +45,14 @@ impl CacheStatus {
Self::LockHit => "lock_hit",
}
}
/// Returns whether this status represents a cache hit.
pub fn is_hit(&self) -> bool {
match self {
CacheStatus::Hit | CacheStatus::LockHit => true,
CacheStatus::Miss | CacheStatus::Expired => false,
}
}
}
#[derive(Debug, Clone)]