Skip to content

Commit

Permalink
Merge pull request #421 from arcstur/patch-1
Browse files Browse the repository at this point in the history
docs: fix per-entry expiration policy documentation
  • Loading branch information
tatsuya6502 authored Jun 2, 2024
2 parents 26bbb2a + a2d09e5 commit 122a5a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/future/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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!");
Expand Down

0 comments on commit 122a5a5

Please sign in to comment.