This commit is contained in:
2025-08-16 09:55:34 +02:00
parent e51af83e45
commit 074be114c3

View File

@@ -673,18 +673,22 @@ async fn keys_cmd(server: &Server) -> Result<Protocol, DBError> {
struct ServerInfo { struct ServerInfo {
redis_version: String, redis_version: String,
encrypted: bool, encrypted: bool,
selected_db: u64,
} }
async fn info_cmd(server: &Server, section: &Option<String>) -> Result<Protocol, DBError> { async fn info_cmd(server: &Server, section: &Option<String>) -> Result<Protocol, DBError> {
let info = ServerInfo { let info = ServerInfo {
redis_version: "7.0.0".to_string(), redis_version: "7.0.0".to_string(),
encrypted: server.current_storage()?.is_encrypted(), encrypted: server.current_storage()?.is_encrypted(),
selected_db: server.selected_db,
}; };
let mut info_string = String::new(); let mut info_string = String::new();
info_string.push_str(&format!("# Server\n")); info_string.push_str(&format!("# Server\n"));
info_string.push_str(&format!("redis_version:{}\n", info.redis_version)); info_string.push_str(&format!("redis_version:{}\n", info.redis_version));
info_string.push_str(&format!("encrypted:{}\n", if info.encrypted { 1 } else { 0 })); info_string.push_str(&format!("encrypted:{}\n", if info.encrypted { 1 } else { 0 }));
info_string.push_str(&format!("# Keyspace\n"));
info_string.push_str(&format!("db{}:keys=0,expires=0,avg_ttl=0\n", info.selected_db));
match section { match section {