From da56ad6eaef156485f52c1cfb591680f7e81c546 Mon Sep 17 00:00:00 2001 From: anotherJJz <470623352@qq.com> Date: Wed, 6 Nov 2024 09:51:08 +0800 Subject: [PATCH] Add API to get dbsize --- src/context/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/context/mod.rs b/src/context/mod.rs index d739d531..79bb8e86 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -782,6 +782,10 @@ impl Context { unsafe { raw::RedisModule_SetContextUser.unwrap()(self.ctx, ptr::null_mut()) }; } + pub fn dbsize(&self) -> u64 { + unsafe { raw::RedisModule_DbSize.unwrap()(self.ctx) } + } + /// Verify the the given user has the give ACL permission on the given key. /// Return Ok(()) if the user has the permissions or error (with relevant error message) /// if the validation failed.