Module embedded_redis::commands::publish
source · Expand description
Abstraction of PUBLISH command.
For general information about this command, see the Redis documentation.
§Using command object
let mut stack = Stack::default();
let clock = StandardClock::default();
let mut connection_handler = ConnectionHandler::resp2(SocketAddr::from_str("127.0.0.1:6379").unwrap());
let client = connection_handler.connect(&mut stack, Some(&clock)).unwrap();
let command = PublishCommand::new("channel", "message");
let response = client.send(command).unwrap().wait().unwrap();
// Returns the number of clients that received the message
assert_eq!(0, response)
§Shorthand
Client provides a shorthand method.
let _ = client.publish("channel", "message");
Structs§
- Abstraction for PUBLISH command