Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix per-entry expiration policy documentation #421

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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