Skip to content

Commit

Permalink
add escape hatch into async client to allow sync calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahab96 committed Apr 10, 2024
1 parent 3de93ac commit 11eb050
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/async_client.rs
Expand Up @@ -22,6 +22,20 @@ impl AsyncClient {
Ok(Client::connect(target)?.into())
}

/// Get a reference to the inner `Client` object.
/// This will allow you to call methods on the `Client` object synchronously.
///
/// Example:
///
/// ```rust
/// let client = memcache::AsyncClient::connect("memcache://localhost:12345").unwrap();
/// let blocking_client = client.blocking();
/// let _: Option<String> = blocking_client.get("foo").unwrap();
/// ```
pub fn blocking(&self) -> &Client {
&self.inner
}

/// Set the socket read timeout for TCP connections.
///
/// Example:
Expand Down

0 comments on commit 11eb050

Please sign in to comment.