mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-20 02:31:35 +02:00
Add is_hit fn to RTCache CacheStatus
This commit is contained in:
parent
c0b23c6736
commit
6e83d51ab1
2 changed files with 9 additions and 1 deletions
2
.bleep
2
.bleep
|
@ -1 +1 @@
|
|||
f87e46c90fe2f84c2ce90ac1def9f4400ae45f24
|
||||
1fe0ed665dfcf6222a4d08f6120172be64d27eb9
|
|
@ -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)]
|
||||
|
|
Loading…
Reference in a new issue