This commit is contained in:
Carl Lerche
2020-04-15 09:47:28 -07:00
committed by GitHub
parent ecf1eb4ea8
commit 81888e36b5
13 changed files with 208 additions and 75 deletions

View File

@@ -24,7 +24,7 @@ enum Command {
/// Get the value of key.
Get {
/// Name of key to get
key: String
key: String,
},
/// Set key to hold the string value.
Set {
@@ -76,11 +76,19 @@ async fn main() -> mini_redis::Result<()> {
println!("(nil)");
}
}
Command::Set { key, value, expires: None } => {
Command::Set {
key,
value,
expires: None,
} => {
client.set(&key, value).await?;
println!("OK");
}
Command::Set { key, value, expires: Some(expires) } => {
Command::Set {
key,
value,
expires: Some(expires),
} => {
client.set_expires(&key, value, expires).await?;
println!("OK");
}