diff --git a/Cargo.toml b/Cargo.toml index 926fe17..a892e9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,9 @@ keywords = ["cache", "object-store", "arrow"] categories = ["caching"] [dependencies] -async-trait = "0.1" +async-trait = "~0.1" bytes = "~1.9" -futures = "0.3" +futures = "~0.3" log = "~0.4" moka = { version = "~0.12", features = ["future"] } num_cpus = "1.16" diff --git a/src/memory.rs b/src/memory.rs index d65056b..ba6d944 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -32,9 +32,9 @@ mod builder; pub use self::builder::InMemoryCacheBuilder; use crate::{paging::PageCache, Error, Result}; -/// Default memory page size is 8 MB -pub const DEFAULT_PAGE_SIZE: usize = 8 * 1024 * 1024; -const DEFAULT_TIME_TO_LIVE: Duration = Duration::from_secs(60 * 30); // 30 minutes +/// Default memory page size is 16 KB +pub const DEFAULT_PAGE_SIZE: usize = 16 * 1024; +const DEFAULT_TIME_TO_IDLE: Duration = Duration::from_secs(60 * 30); // 30 minutes /// In-memory [`PageCache`] implementation. /// @@ -85,7 +85,7 @@ impl InMemoryCache { /// - `page_size`: The maximum size of each page. /// pub fn new(capacity_bytes: usize, page_size: usize) -> Self { - Self::with_params(capacity_bytes, page_size, DEFAULT_TIME_TO_LIVE) + Self::with_params(capacity_bytes, page_size, DEFAULT_TIME_TO_IDLE) } /// Create a new cache with a size that is a fraction of the system memory diff --git a/src/memory/builder.rs b/src/memory/builder.rs index 1e4b19e..65b9137 100644 --- a/src/memory/builder.rs +++ b/src/memory/builder.rs @@ -3,7 +3,7 @@ use std::time::Duration; -use super::{InMemoryCache, DEFAULT_PAGE_SIZE, DEFAULT_TIME_TO_LIVE}; +use super::{InMemoryCache, DEFAULT_PAGE_SIZE, DEFAULT_TIME_TO_IDLE}; /// Builder for [`InMemoryCache`] pub struct InMemoryCacheBuilder { @@ -18,7 +18,7 @@ impl InMemoryCacheBuilder { Self { capacity, page_size: DEFAULT_PAGE_SIZE, - time_to_idle: DEFAULT_TIME_TO_LIVE, + time_to_idle: DEFAULT_TIME_TO_IDLE, } }