Skip to content

Commit

Permalink
Optimize the codes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmqtt committed Dec 12, 2023
1 parent c6c80f1 commit 115161d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ mod tests {

fn get_cfg(name: &str) -> Config {
let cfg = Config {
storage_type: StorageType::Sled,
storage_type: StorageType::Redis,
sled: SledConfig {
path: format!("./.catch/{}", name),
gc_at_hour: 0,
Expand Down Expand Up @@ -1312,4 +1312,20 @@ mod tests {
assert_eq!(l11.len().await.unwrap(), 0);
assert_eq!(l11.all::<i32>().await.unwrap(), vec![]);
}

#[tokio::main]
#[test]
async fn test_session_iter() {
let cfg = get_cfg("session");
let mut db = init_db(&cfg).await.unwrap();
let now = std::time::Instant::now();
let mut iter = db.map_iter().await.unwrap();
let mut count = 0;
while let Some(m) = iter.next().await {
let _m = m.unwrap();
//println!("map name: {:?}", String::from_utf8_lossy(m.name()));
count += 1;
}
println!("count: {}, cost time: {:?}", count, now.elapsed());
}
}

0 comments on commit 115161d

Please sign in to comment.