Skip to content

Commit

Permalink
Merge fee659e into baa9aa8
Browse files Browse the repository at this point in the history
  • Loading branch information
letmutx committed Feb 4, 2020
2 parents baa9aa8 + fee659e commit aefd62b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ impl Client {
/// ```rust
/// let client = memcache::Client::connect("memcache://localhost:12345").unwrap();
/// client.set("foo", "bar", 10).unwrap();
/// # client.flush().unwrap();
/// ```
pub fn set<V: ToMemcacheValue<Stream>>(&self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError> {
return self.get_connection(key).get_ref().set(key, value, expiration);
Expand All @@ -241,6 +242,7 @@ impl Client {
/// let (_, _, cas) = result.get("foo").unwrap();
/// let cas = cas.unwrap();
/// assert_eq!(true, client.cas("foo", "bar2", 10, cas).unwrap());
/// # client.flush().unwrap();
/// ```
pub fn cas<V: ToMemcacheValue<Stream>>(
&self,
Expand All @@ -261,6 +263,7 @@ impl Client {
/// let key = "add_test";
/// client.delete(key).unwrap();
/// client.add(key, "bar", 100000000).unwrap();
/// # client.flush().unwrap();
/// ```
pub fn add<V: ToMemcacheValue<Stream>>(&self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError> {
return self.get_connection(key).get_ref().add(key, value, expiration);
Expand All @@ -275,6 +278,7 @@ impl Client {
/// let key = "replace_test";
/// client.set(key, "bar", 0).unwrap();
/// client.replace(key, "baz", 100000000).unwrap();
/// # client.flush().unwrap();
/// ```
pub fn replace<V: ToMemcacheValue<Stream>>(
&self,
Expand All @@ -296,6 +300,7 @@ impl Client {
/// client.append(key, ", world!").unwrap();
/// let result: String = client.get(key).unwrap().unwrap();
/// assert_eq!(result, "hello, world!");
/// # client.flush().unwrap();
/// ```
pub fn append<V: ToMemcacheValue<Stream>>(&self, key: &str, value: V) -> Result<(), MemcacheError> {
return self.get_connection(key).get_ref().append(key, value);
Expand All @@ -312,6 +317,7 @@ impl Client {
/// client.prepend(key, "hello, ").unwrap();
/// let result: String = client.get(key).unwrap().unwrap();
/// assert_eq!(result, "hello, world!");
/// # client.flush().unwrap();
/// ```
pub fn prepend<V: ToMemcacheValue<Stream>>(&self, key: &str, value: V) -> Result<(), MemcacheError> {
return self.get_connection(key).get_ref().prepend(key, value);
Expand All @@ -324,6 +330,7 @@ impl Client {
/// ```rust
/// let client = memcache::Client::connect("memcache://localhost:12345").unwrap();
/// client.delete("foo").unwrap();
/// # client.flush().unwrap();
/// ```
pub fn delete(&self, key: &str) -> Result<bool, MemcacheError> {
return self.get_connection(key).get_ref().delete(key);
Expand All @@ -336,6 +343,7 @@ impl Client {
/// ```rust
/// let client = memcache::Client::connect("memcache://localhost:12345").unwrap();
/// client.increment("counter", 42).unwrap();
/// # client.flush().unwrap();
/// ```
pub fn increment(&self, key: &str, amount: u64) -> Result<u64, MemcacheError> {
return self.get_connection(key).get_ref().increment(key, amount);
Expand All @@ -348,6 +356,7 @@ impl Client {
/// ```rust
/// let client = memcache::Client::connect("memcache://localhost:12345").unwrap();
/// client.decrement("counter", 42).unwrap();
/// # client.flush().unwrap();
/// ```
pub fn decrement(&self, key: &str, amount: u64) -> Result<u64, MemcacheError> {
return self.get_connection(key).get_ref().decrement(key, amount);
Expand All @@ -362,6 +371,7 @@ impl Client {
/// assert_eq!(client.touch("not_exists_key", 12345).unwrap(), false);
/// client.set("foo", "bar", 123).unwrap();
/// assert_eq!(client.touch("foo", 12345).unwrap(), true);
/// # client.flush().unwrap();
/// ```
pub fn touch(&self, key: &str, expiration: u32) -> Result<bool, MemcacheError> {
return self.get_connection(key).get_ref().touch(key, expiration);
Expand Down

0 comments on commit aefd62b

Please sign in to comment.