-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
I use cached to check whether a key exist in the past 2 seconds, and I write an unit test, but it doesn't works.
#[cfg(test)]
mod tests {
use std::thread::sleep;
use cached::Cached;
#[test]
fn a() {
let mut c = cached::TimedCache::with_lifespan_and_refresh(2, true);
for i in 1..5 {
let key = i.to_string().repeat(9999999);
let value = true;
c.cache_set(key, value);
sleep(std::time::Duration::from_secs(1));
// println!("{:?}", c.get_store());
}
assert!(c.cache_set(1.to_string().repeat(9999999), true).is_none());
}
}Metadata
Metadata
Assignees
Labels
No labels