[−][src]Struct redis::Client
The client type.
Methods
impl Client
[src]
The client acts as connector to the redis server. By itself it does not do much other than providing a convenient way to fetch a connection from it. In the future the plan is to provide a connection pool in the client.
When opening a client a URL in the following format should be used:
redis://host:port/db
Example usage::
let client = redis::Client::open("redis://127.0.0.1/").unwrap(); let con = client.get_connection().unwrap();
pub fn open<T: IntoConnectionInfo>(params: T) -> RedisResult<Client>
[src]
Connects to a redis server and returns a client. This does not actually open a connection yet but it does perform some basic checks on the URL that might make the operation fail.
pub fn get_connection(&self) -> RedisResult<Connection>
[src]
Instructs the client to actually connect to redis and returns a connection object. The connection object can be used to send commands to the server. This can fail with a variety of errors (like unreachable host) so it's important that you handle those errors.
pub fn get_connection_with_timeout(
&self,
timeout: Duration
) -> RedisResult<Connection>
[src]
&self,
timeout: Duration
) -> RedisResult<Connection>
Instructs the client to actually connect to redis with specified timeout and returns a connection object. The connection object can be used to send commands to the server. This can fail with a variety of errors (like unreachable host) so it's important that you handle those errors.
pub async fn get_async_connection<'_>(&'_ self) -> RedisResult<Connection>
[src]
Returns an async connection from the client.
pub async fn get_multiplexed_tokio_connection<'_>(
&'_ self
) -> RedisResult<MultiplexedConnection>
[src]
&'_ self
) -> RedisResult<MultiplexedConnection>
Returns an async multiplexed connection from the client.
A multiplexed connection can be cloned, allowing requests to be be sent concurrently on the same underlying connection (tcp/unix socket).
This requires the tokio-executor
feature as it uses the default tokio executor.
pub async fn get_multiplexed_async_connection<'_>(
&'_ self
) -> RedisResult<(MultiplexedConnection, impl Future<Output = ()>)>
[src]
&'_ self
) -> RedisResult<(MultiplexedConnection, impl Future<Output = ()>)>
Returns an async multiplexed connection from the client and a future which must be polled
to drive any requests submitted to it (see get_multiplexed_tokio_connection
).
A multiplexed connection can be cloned, allowing requests to be be sent concurrently on the same underlying connection (tcp/unix socket).
Trait Implementations
impl Clone for Client
[src]
impl ConnectionLike for Client
[src]
fn req_packed_command(&mut self, cmd: &[u8]) -> RedisResult<Value>
[src]
fn req_packed_commands(
&mut self,
cmd: &[u8],
offset: usize,
count: usize
) -> RedisResult<Vec<Value>>
[src]
&mut self,
cmd: &[u8],
offset: usize,
count: usize
) -> RedisResult<Vec<Value>>
fn get_db(&self) -> i64
[src]
fn check_connection(&mut self) -> bool
[src]
fn is_open(&self) -> bool
[src]
impl Debug for Client
[src]
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,