Complete these tasks to reinforce what you learned in this module.
Connect to Redis at redis://127.0.0.1/ (or from env REDIS_URL). Set a key task1_key to the value task1_value, then get it and print the value. Use AsyncCommands and #[tokio::main]. Handle errors with ?.
AsyncCommands trait: one method to set a key-value pair, one to get the value. Both are async; use ? and #[tokio::main].// Task 1: SET and GET. See tasks/TASKS.md.
fn main() {
todo!("Connect to Redis, set task1_key, get and print");
}
Set a key task2_key to task2_value with an expiry of 10 seconds using .set_ex. Then get the key and print it. (Optional: sleep 11 seconds and get again to see None/error.)
// Task 2: SET with TTL. See tasks/TASKS.md.
fn main() {
todo!("set_ex task2_key, get and print");
}