pub struct RedisPersistence { /* private fields */ }
Expand description
The MQTT Redis persistence object. An instance of this stuct can be residtered with an MQTT client to hold messgaes in a Redis server until they are properly acknowledged by the remote MQTT server. An instance of this object maps to a single hash on a specific Redis server.
Implementations§
Trait Implementations§
Source§impl ClientPersistence for RedisPersistence
impl ClientPersistence for RedisPersistence
Source§fn open(&mut self, client_id: &str, server_uri: &str) -> Result<()>
fn open(&mut self, client_id: &str, server_uri: &str) -> Result<()>
Opena the connection to the Redis client.
Source§fn put(&mut self, key: &str, buffers: Vec<&[u8]>) -> Result<()>
fn put(&mut self, key: &str, buffers: Vec<&[u8]>) -> Result<()>
Store a persistent value to Redis. We get a vector of buffer references for the data to store, which we can concatenate into a single byte buffer to send to the server.
Source§fn get(&mut self, key: &str) -> Result<Vec<u8>>
fn get(&mut self, key: &str) -> Result<Vec<u8>>
Get the data buffer for the requested key. Although the value sent to the server was a collection of buffers, we can return them as a single, concatenated buffer.
Source§fn remove(&mut self, key: &str) -> Result<()>
fn remove(&mut self, key: &str) -> Result<()>
Remove the value with the specified key
from the store.
Source§fn keys(&mut self) -> Result<Vec<String>>
fn keys(&mut self) -> Result<Vec<String>>
Return a collection of all the keys in the store for this client.
Source§fn contains_key(&mut self, key: &str) -> bool
fn contains_key(&mut self, key: &str) -> bool
Determines if the store for this client contains the specified key
.