Struct embedded_redis::network::Client
source · pub struct Client<'a, N: TcpClientStack, C: Clock, P: Protocol>where
HelloCommand: Command<<P as Protocol>::FrameType>,{ /* private fields */ }
Expand description
Client to execute Redis commands
The functionality of the client is best explained by a command example.
Implementations§
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn bgsave(
&'a self,
schedule: bool
) -> Result<Future<'a, N, C, P, BackgroundSaveCommand>, CommandErrors>where
<P as Protocol>::FrameType: From<CommandBuilder>,
pub fn bgsave(
&'a self,
schedule: bool
) -> Result<Future<'a, N, C, P, BackgroundSaveCommand>, CommandErrors>where
<P as Protocol>::FrameType: From<CommandBuilder>,
Shorthand for BackgroundSaveCommand
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn get<K>(
&'a self,
key: K
) -> Result<Future<'a, N, C, P, GetCommand>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K>,
pub fn get<K>(
&'a self,
key: K
) -> Result<Future<'a, N, C, P, GetCommand>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K>,
Shorthand for GetCommand
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn hget<K, F>(
&'a self,
key: K,
field: F
) -> Result<Future<'a, N, C, P, HashGetCommand>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<F>,
pub fn hget<K, F>(
&'a self,
key: K,
field: F
) -> Result<Future<'a, N, C, P, HashGetCommand>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<F>,
Shorthand for HashGetCommand
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn hgetall<K>(
&'a self,
key: K
) -> Result<Future<'a, N, C, P, HashGetAllCommand>, CommandErrors>
pub fn hgetall<K>( &'a self, key: K ) -> Result<Future<'a, N, C, P, HashGetAllCommand>, CommandErrors>
Shorthand for HashGetAllCommand
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn hset<K, F, V>(
&'a self,
key: K,
field: F,
value: V
) -> Result<Future<'a, N, C, P, HashSetCommand<1>>, CommandErrors>
pub fn hset<K, F, V>( &'a self, key: K, field: F, value: V ) -> Result<Future<'a, N, C, P, HashSetCommand<1>>, CommandErrors>
Shorthand for HashSetCommand For setting multiple fields, use HashSetCommand directly instead
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn ping(&'a self) -> Result<Future<'a, N, C, P, PingCommand>, CommandErrors>
pub fn ping(&'a self) -> Result<Future<'a, N, C, P, PingCommand>, CommandErrors>
Shorthand for PingCommand
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn publish<K, V>(
&'a self,
channel: K,
message: V
) -> Result<Future<'a, N, C, P, PublishCommand>, CommandErrors>
pub fn publish<K, V>( &'a self, channel: K, message: V ) -> Result<Future<'a, N, C, P, PublishCommand>, CommandErrors>
Shorthand for PublishCommand
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn set<K, V>(
&'a self,
key: K,
value: V
) -> Result<Future<'a, N, C, P, SetCommand<ConfirmationResponse>>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + ToStringOption + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<V>,
pub fn set<K, V>(
&'a self,
key: K,
value: V
) -> Result<Future<'a, N, C, P, SetCommand<ConfirmationResponse>>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + ToStringOption + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<V>,
Shorthand for SetCommand For using options of SET command, use SetCommand directly instead
source§impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, N: TcpClientStack, C: Clock, P: Protocol> Client<'a, N, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
sourcepub fn send<Cmd>(
&'a self,
command: Cmd
) -> Result<Future<'_, N, C, P, Cmd>, CommandErrors>where
Cmd: Command<P::FrameType>,
pub fn send<Cmd>(
&'a self,
command: Cmd
) -> Result<Future<'_, N, C, P, Cmd>, CommandErrors>where
Cmd: Command<P::FrameType>,
Sends the given command non-blocking
sourcepub fn subscribe<const L: usize>(
self,
channels: [Bytes; L]
) -> Result<Subscription<'a, N, C, P, L>, Error>where
<P as Protocol>::FrameType: ToPushMessage + From<CommandBuilder>,
pub fn subscribe<const L: usize>(
self,
channels: [Bytes; L]
) -> Result<Subscription<'a, N, C, P, L>, Error>where
<P as Protocol>::FrameType: ToPushMessage + From<CommandBuilder>,
Subscribes the given channels and returns a subscription client.
If the subscriptions fails, it’s recommended to close the connection, as a the state is undefined. A further reuse of the connection could cause subsequent errors
source§impl<'a, N: TcpClientStack, C: Clock> Client<'a, N, C, Resp3>
impl<'a, N: TcpClientStack, C: Clock> Client<'a, N, C, Resp3>
sourcepub fn get_hello_response(&self) -> &HelloResponse
pub fn get_hello_response(&self) -> &HelloResponse
Returns the response to HELLO command executed during connection initialization [Client HELLO response]