From af1cef6b9642b8915d19fcd7917536fe0dba4410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=8A=E6=AC=A7?= Date: Thu, 28 Nov 2024 20:22:07 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Limit=20the=20cache=20capacity.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/database_driver_native/src/kv.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/database_driver_native/src/kv.rs b/packages/database_driver_native/src/kv.rs index 2e321cf..60b8555 100644 --- a/packages/database_driver_native/src/kv.rs +++ b/packages/database_driver_native/src/kv.rs @@ -56,6 +56,9 @@ impl KVStore for ProxyKV { pub async fn init_kv(path: impl ToString) -> Result { Ok(ProxyKV { - db: sled::open(path.to_string())?, + db: sled::Config::default() + .cache_capacity(10 * 1024 * 1024) // 10 MiB + .path(path.to_string()) + .open()?, }) }