pub struct Client<'a, T: Read + Write, 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, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn bgsave(&self, schedule: bool) -> Result<(), CommandErrors>where
<P as Protocol>::FrameType: From<CommandBuilder>,
pub async fn bgsave(&self, schedule: bool) -> Result<(), CommandErrors>where
<P as Protocol>::FrameType: From<CommandBuilder>,
Shorthand for BackgroundSaveCommand
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn get<K>(&self, key: K) -> Result<Option<GetResponse>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K>,
pub async fn get<K>(&self, key: K) -> Result<Option<GetResponse>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K>,
Shorthand for GetCommand
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn hget<K, F>(
&self,
key: K,
field: F,
) -> Result<Option<GetResponse>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<F>,
pub async fn hget<K, F>(
&self,
key: K,
field: F,
) -> Result<Option<GetResponse>, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<F>,
Shorthand for HashGetCommand
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn hgetall<K>(
&self,
key: K,
) -> Result<Option<HashResponse>, CommandErrors>
pub async fn hgetall<K>( &self, key: K, ) -> Result<Option<HashResponse>, CommandErrors>
Shorthand for HashGetAllCommand
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn hset<K, F, V>(
&self,
key: K,
field: F,
value: V,
) -> Result<i64, CommandErrors>
pub async fn hset<K, F, V>( &self, key: K, field: F, value: V, ) -> Result<i64, CommandErrors>
Shorthand for HashSetCommand For setting multiple fields, use HashSetCommand directly instead
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn keys<K>(&self, pattern: K) -> Result<Vec<Bytes>, CommandErrors>
pub async fn keys<K>(&self, pattern: K) -> Result<Vec<Bytes>, CommandErrors>
Shorthand for KeysCommand. Returns matching keys, or an empty vector if none match.
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn ping(&self) -> Result<(), CommandErrors>
pub async fn ping(&self) -> Result<(), CommandErrors>
Shorthand for PingCommand
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn publish<K, V>(
&self,
channel: K,
message: V,
) -> Result<i64, CommandErrors>
pub async fn publish<K, V>( &self, channel: K, message: V, ) -> Result<i64, CommandErrors>
Shorthand for PublishCommand
Source§impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn set<K, V>(
&self,
key: K,
value: V,
) -> Result<ConfirmationResponse, CommandErrors>where
<P as Protocol>::FrameType: ToStringBytes + ToStringOption + IsNullFrame + From<CommandBuilder>,
Bytes: From<K> + From<V>,
pub async fn set<K, V>(
&self,
key: K,
value: V,
) -> Result<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, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
impl<'a, T: Read + Write, C: Clock, P: Protocol> Client<'a, T, C, P>where
AuthCommand: Command<<P as Protocol>::FrameType>,
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub async fn send<Cmd>(
&self,
command: Cmd,
) -> Result<Cmd::Response, CommandErrors>where
Cmd: Command<P::FrameType>,
pub async fn send<Cmd>(
&self,
command: Cmd,
) -> Result<Cmd::Response, CommandErrors>where
Cmd: Command<P::FrameType>,
Sends the given command and asynchronously waits for its evaluated response.
Sourcepub async fn subscribe<const L: usize>(
self,
channels: [Bytes; L],
) -> Result<Subscription<'a, T, C, P, L>, Error>where
<P as Protocol>::FrameType: ToPushMessage + From<CommandBuilder>,
pub async fn subscribe<const L: usize>(
self,
channels: [Bytes; L],
) -> Result<Subscription<'a, T, C, P, L>, Error>where
<P as Protocol>::FrameType: ToPushMessage + From<CommandBuilder>,
Subscribes the given channels and returns a subscription client.
If subscribing fails, drop the client so its connection is closed; the server-side state may be undefined.
Source§impl<T: Read + Write, C: Clock> Client<'_, T, C, Resp3>
impl<T: Read + Write, C: Clock> Client<'_, T, 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]
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, C, P> !Freeze for Client<'a, T, C, P>
impl<'a, T, C, P> !RefUnwindSafe for Client<'a, T, C, P>
impl<'a, T, C, P> !Send for Client<'a, T, C, P>
impl<'a, T, C, P> !Sync for Client<'a, T, C, P>
impl<'a, T, C, P> !Unpin for Client<'a, T, C, P>
impl<'a, T, C, P> !UnsafeUnpin for Client<'a, T, C, P>
impl<'a, T, C, P> !UnwindSafe for Client<'a, T, C, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more