Expand description
rust-memcache is a memcached client written in pure rust.
§Install:
The crate is called memcache and you can depend on it via cargo:
[dependencies]
memcache = "*"§Features:
-  All memcached supported protocols
- Binary protocol
 - ASCII protocol
 
 -  All memcached supported connections
- TCP connection
 - UDP connection
 - UNIX Domain socket connection
 - TLS connection
 
 -  Encodings
- Typed interface
 - Automatically compress
 - Automatically serialize to JSON / msgpack etc
 
 - Mutiple server support with custom key hash algorithm
 -  Authority
- Binary protocol (plain SASL authority)
 - ASCII protocol
 
 
§Basic usage:
// create connection with to memcached server node:
let client = memcache::connect("memcache://127.0.0.1:12345?timeout=10&tcp_nodelay=true").unwrap();
// flush the database:
client.flush().unwrap();
// set a string value:
client.set("foo", "bar", 0).unwrap();
// retrieve from memcached:
let value: Option<String> = client.get("foo").unwrap();
assert_eq!(value, Some(String::from("bar")));
assert_eq!(value.unwrap(), "bar");
// prepend, append:
client.prepend("foo", "foo").unwrap();
client.append("foo", "baz").unwrap();
let value: String = client.get("foo").unwrap().unwrap();
assert_eq!(value, "foobarbaz");
// delete value:
client.delete("foo").unwrap();
// using counter:
client.set("counter", 40, 0).unwrap();
client.increment("counter", 2).unwrap();
let answer: i32 = client.get("counter").unwrap().unwrap();
assert_eq!(answer, 42);!
Structs§
- Client
 - Client
Builder  - Connection
Manager  - Memcache connection manager implementing rd2d Pool ManageConnection
 - Error
 - The error type returned by methods in this crate.
 - Url
 - A parsed URL record.
 
Enums§
- Client
Error  - Client-side errors
 - Command
Error  - Command specific errors.
 - Memcache
Error  - Stands for errors raised from rust-memcache
 - Server
Error  - Server-side errors
 - Stream
 - UrlParse
Error  - Errors that can occur during parsing.
 
Traits§
- Connectable
 - From
Memcache Value  - determine how the value is unserialize to memcache
 - From
Memcache Value Ext  - ToMemcache
Value  - determine how the value is serialize to memcache
 
Functions§
- connect
 - Create a memcached client instance and connect to memcached server.
 
Type Aliases§
- Pool
 - R2D2 connection pool