feat: add adaptive pool metrics and self-check

This commit is contained in:
fawney19
2026-05-15 02:21:11 +08:00
parent bf511f9f8c
commit 54a8312e46
34 changed files with 4521 additions and 300 deletions
@@ -349,6 +349,14 @@ impl MemoryRuntimeBackend {
before.saturating_sub(set.len())
}
pub(crate) async fn score_remove(&self, key: &str, member: &str) -> bool {
self.scores
.lock()
.await
.get_mut(key)
.is_some_and(|set| set.remove(member).is_some())
}
pub(crate) async fn score_len(&self, key: &str) -> usize {
self.scores.lock().await.get(key).map_or(0, BTreeMap::len)
}