hello-redis.rs 440 B

1234567891011121314151617
  1. use mini_redis::{client, Result};
  2. #[tokio::main]
  3. async fn main() -> Result<()> {
  4. // Open a connection to the mini-redis address.
  5. let mut client = client::connect("127.0.0.1:6379").await?;
  6. // Set the key "hello" with value "world"
  7. client.set("hello", "world".into()).await?;
  8. // Get key "hello"
  9. let result = client.get("hello").await?;
  10. println!("got value from the server; result={:?}", result);
  11. Ok(())
  12. }