From fc1ec41529d2a4cead2f4a79fd2b54d73efce6e1 Mon Sep 17 00:00:00 2001 From: Lei Xu Date: Sun, 1 Dec 2024 19:19:25 -0800 Subject: [PATCH 1/2] add missing commit that address comments --- Cargo.toml | 6 +++--- src/memory.rs | 8 ++++---- src/memory/builder.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 926fe17..f65dd68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,12 +9,12 @@ 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" +num_cpus = "~1.16" object_store = "~0.11" sysinfo = "~0.32" tokio = { version = "1", features = ["sync"] } 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, } } From 346fde66237716cc07c3b0fbcb307b329da62740 Mon Sep 17 00:00:00 2001 From: Lei Xu Date: Mon, 2 Dec 2024 08:35:34 -0800 Subject: [PATCH 2/2] address comments --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f65dd68..a892e9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ bytes = "~1.9" futures = "~0.3" log = "~0.4" moka = { version = "~0.12", features = ["future"] } -num_cpus = "~1.16" +num_cpus = "1.16" object_store = "~0.11" sysinfo = "~0.32" tokio = { version = "1", features = ["sync"] }