pub struct Famcache {
pub messaging: Arc<Messaging>,
/* private fields */
}
Fields§
§messaging: Arc<Messaging>
Implementations§
Source§impl Famcache
impl Famcache
Sourcepub async fn connect(&mut self) -> Result<()>
pub async fn connect(&mut self) -> Result<()>
Open a connection to the server
§Example
use famcache::{Famcache, Config};
#[tokio::main]
async fn main() {
let mut client = Famcache::new(Config::new("localhost", 3577));
client.connect().await.unwrap();
println!("Connected to server");
}
Sourcepub async fn get(&self, key: &str) -> Result<Option<String>>
pub async fn get(&self, key: &str) -> Result<Option<String>>
Get a value from the server
§Example
use famcache::{Famcache, Config};
#[tokio::main]
async fn main() {
let mut client = Famcache::new(Config::new("localhost", 3577));
client.connect().await.unwrap();
client.get("test").await.unwrap();
}
Sourcepub async fn set(&self, key: &str, value: &str, ttl: Option<u64>) -> Result<()>
pub async fn set(&self, key: &str, value: &str, ttl: Option<u64>) -> Result<()>
Set a value on the server
§Example
use famcache::{Famcache, Config};
#[tokio::main]
async fn main() {
let mut client = Famcache::new(Config::new("localhost", 3577));
client.connect().await.unwrap();
client.set("test", "val", None).await.unwrap();
}
Auto Trait Implementations§
impl Freeze for Famcache
impl !RefUnwindSafe for Famcache
impl Send for Famcache
impl Sync for Famcache
impl Unpin for Famcache
impl !UnwindSafe for Famcache
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
Mutably borrows from an owned value. Read more