Struct memcached::client::Client

source ·
pub struct Client { /* private fields */ }
Expand description

Memcached client

use memcached::client::{Client};
use memcached::proto::{CasOperation, MultiOperation, NoReplyOperation, Operation, ProtoType};

let mut client = Client::connect(&[("tcp://127.0.0.1:11211", 1)], ProtoType::Binary).unwrap();

client.set(b"Foo", b"Bar", 0xdeadbeef, 2).unwrap();
let (value, flags) = client.get(b"Foo").unwrap();
assert_eq!(&value[..], b"Bar");
assert_eq!(flags, 0xdeadbeef);

client.set_noreply(b"key:dontreply", b"1", 0x00000001, 20).unwrap();

let (_, cas_val) = client.increment_cas(b"key:numerical", 10, 1, 20, 0).unwrap();
client.increment_cas(b"key:numerical", 1, 1, 20, cas_val).unwrap();

Implementations

Connect to Memcached servers

This function accept multiple servers, servers information should be represented as a array of tuples in this form

(address, weight).

Connect to Memcached servers that require SASL authentication

This function accept multiple servers, servers information should be represented as a array of tuples in this form

(address, weight).

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.