diff --git a/src/future/cache.rs b/src/future/cache.rs index 1c17e19c..bd7b3f46 100644 --- a/src/future/cache.rs +++ b/src/future/cache.rs @@ -313,9 +313,9 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// // /// // [dependencies] /// // moka = { version = "0.12", features = ["future"] } -/// // tokio = { version = "1", features = ["rt-multi-thread", "macros" ] } +/// // tokio = { version = "1", features = ["rt-multi-thread", "macros", "time" ] } /// -/// use moka::{future::{Cache, FutureExt}, Expiry, notification::ListenerFuture}; +/// use moka::{future::Cache, Expiry}; /// use std::time::{Duration, Instant}; /// /// // In this example, we will create a `future::Cache` with `u32` as the key, and @@ -403,6 +403,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// // Sleep for 6 seconds. Key 0 should expire. /// println!("\nSleeping for 6 seconds...\n"); /// tokio::time::sleep(Duration::from_secs(6)).await; +/// cache.run_pending_tasks().await; /// println!("Entry count: {}", cache.entry_count()); /// /// // Verify that key 0 has been evicted. @@ -413,6 +414,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// // Sleep for 10 more seconds. Key 1 should expire. /// println!("\nSleeping for 10 seconds...\n"); /// tokio::time::sleep(Duration::from_secs(10)).await; +/// cache.run_pending_tasks().await; /// println!("Entry count: {}", cache.entry_count()); /// /// // Verify that key 1 has been evicted. @@ -425,6 +427,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// /// println!("\nSleeping for a second...\n"); /// tokio::time::sleep(Duration::from_secs(1)).await; +/// cache.run_pending_tasks().await; /// println!("Entry count: {}", cache.entry_count()); /// /// println!("\nDone!");