memcache client for rust

Overview

rust-memcache

Build Status Codecov Status Crates.io MIT licensed Docs Gitter chat

rust-memcache is a memcached client written in pure rust.

logo

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
  • Memcached cluster support with custom key hash algorithm
  • Authority
    • Binary protocol (plain SASL authority plain)
    • 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);

Custom key hash function

If you have multiple memcached server, you can create the memcache::Client struct with a vector of urls of them. Which server will be used to store and retrive is based on what the key is.

This library have a basic rule to do this with rust's builtin hash function, and also you can use your custom function to do this, for something like you can using a have more data on one server which have more memory quota, or cluster keys with their prefix, or using consitent hash for large memcached cluster.

let mut client = memcache::connect(vec!["memcache://127.0.0.1:12345", "memcache:///tmp/memcached.sock"]).unwrap();
client.hash_function = |key: &str| -> u64 {
    // your custom hashing function here
    return 1;
};

Contributing

Before sending pull request, please ensure:

  • cargo fmt is being run;
  • Commit message is using gitmoji with first character is lower cased, for example: :sparkles: rust-memcache can print money now.

Contributors

License

MIT

Comments
  • Support TCP_NODELAY

    Support TCP_NODELAY

    Support TCP_NODELAY for performance improvement.

    I tested performance in my environment, but that was not well. It was caused by TCP_NODELAY being disabled.

    My test code is here

    #[test]
    fn memcache_bench() {
        extern crate memcache;
    
        let mut conn = memcache::Client::new("memcache://localhost:20343").unwrap();
    
        conn.set_nodelay(true).unwrap();
        let start = ::std::time::Instant::now();
        for _ in 0..1000 {
            let _: Option<String> = conn.get("foo").unwrap();
        }
        let elapsed = start.elapsed();
        println!(
            "Elapsed (nodelay enabled): {}.{}",
            elapsed.as_secs(),
            elapsed.subsec_nanos() / 1_000_000
        );
    
        conn.set_nodelay(false).unwrap();
        let start = ::std::time::Instant::now();
        for _ in 0..1000 {
            let _: Option<String> = conn.get("foo").unwrap();
        }
        let elapsed = start.elapsed();
        println!(
            "Elapsed (nodelay disabled): {}.{}",
            elapsed.as_secs(),
            elapsed.subsec_nanos() / 1_000_000
        );
    }
    

    And results is

    $ cargo test memcache_bench --release --lib -- --nocapture
        Finished release [optimized] target(s) in 0.0 secs
         Running *****-3c8e21312813a3b5
    
    running 1 test
    Elapsed (nodelay enabled): 0.47
    Elapsed (nodelay disabled): 44.163
    test pool::tests::memcache_bench ... ok
    

    Thanks.

    opened by alu 10
  • Add optional TLS Support

    Add optional TLS Support

    This adds TLS support to the memcache client. Users opt-in to a TLS connection by using a URL in the form of:

    memcache+tls://HOST:PORT

    TLS was added to memcached in version 1.5.13.

    TLS options are available as query parameters, in line with the previous tcp options. The available options are:

    verify_mode = peer | none (default peer) ca_path = PATH key_path = PATH cert_path = PATH

    This adds the openssl crate as a dependency.

    I've split this into 2 commits, the first commit is a small refactoring that made it a bit easier to add a new transport.

    If this PR is of interest to you, please let me know and I can spend a bit more time adding tests into your existing test setup.

    opened by stevendanna 8
  • Add support for UDP connection

    Add support for UDP connection

    List of commands supported (all which are currently supported for TCP except multi-get):

    • Version
    • Flush
    • Flush With Delay
    • Get
    • Set
    • Replace
    • Add
    • Append
    • Delete
    • Prepend
    • Increment
    • Decrement
    • Touch

    Design:

    1. We use two buffers called read_buf and write_buf for UDP data transfer (See struct UcpConnection in connection.rs). Since the payload can't span multiple datagrams as it does for TCP, we choose to send requests and parse responses in the following manner:
    2. For requests, we write data part by part (just like we do for TCP) in a byte vector called write_buf. After the command is completely written, we call flush on the connection which sends the command and accompanying data stored in write_bufto the server (See flush() in connection.rs).
    3. After doing step 2, we wait for the response in the same flush() function. When the response from the server comes in, we store it in read_bufand then read it part by part just like we would do for a TCP stream.

    Test results:

    faisal@faisal-VirtualBox:~/abbasfaisal/rust-memcache$ RUST_BACKTRACE=1 cargo test -- --nocapture
       Compiling memcache v0.7.1 (file:///home/faisal/abbasfaisal/rust-memcache)
        Finished dev [unoptimized + debuginfo] target(s) in 8.74s
         Running target/debug/deps/memcache-23055108b9341b1e
    
    running 4 tests
    test client::tests::delete ... ok
    test client::tests::increment ... ok
    test client::tests::unix ... ok
    test connection::tests::tcp_nodelay ... ok
    
    test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    
         Running target/debug/deps/tests-1ecd6df755552d8e
    
    running 2 tests
    test test ... ok
    test udp_test ... ok
    
    test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    
       Doc-tests memcache
    
    running 15 tests
    test src/client.rs - client::Client::add (line 270) ... ok
    test src/client.rs - client::Client::append (line 308) ... ok
    test src/client.rs - client::Client::decrement (line 441) ... ok
    test src/client.rs - client::Client::delete (line 376) ... ok
    test src/client.rs - client::Client::flush (line 87) ... ok
    test src/client.rs - client::Client::flush_with_delay (line 109) ... ok
    test src/client.rs - client::Client::get (line 134) ... ok
    test src/client.rs - client::Client::gets (line 159) ... ok
    test src/client.rs - client::Client::increment (line 401) ... ok
    test src/client.rs - client::Client::prepend (line 342) ... ok
    test src/client.rs - client::Client::replace (line 289) ... ok
    test src/client.rs - client::Client::set (line 253) ... ok
    test src/client.rs - client::Client::touch (line 481) ... ok
    test src/client.rs - client::Client::version (line 62) ... ok
    test src/lib.rs -  (line 25) ... ok
    
    test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    
    
    opened by abbasfaisal 6
  • Support multiple servers

    Support multiple servers

    By now the project supports just one server. It is recommended by the memcached project site that clients can hash servers and keys so things go to right location.

    opened by paulosuzart 6
  • Better error type

    Better error type

    Fixes #79

    I may have gone a bit overboard refactoring the binary protocol. Sorry about that!

    The issue with returning same errors in both ASCII and binary protocol is that the format of errors is different. We should instead document that the errors returned by both the protocols may be different but guarantee that the same error is returned in the future versions too for compatibility.

    opened by letmutx 5
  • First changes to compat with rust 1.0.0-dev 1fd89b625 2015-04-07

    First changes to compat with rust 1.0.0-dev 1fd89b625 2015-04-07

    Hi,

    this makes this project compatible with rust beta, but compiled with a nightly version after the beta release. So, it is just a matter of time to do a double check with the final 1.0 release.

    On running tests you'll notice something I'll explain in a moment.

    bests

    opened by paulosuzart 5
  • Use custom BufReader impl for Ascii protocol

    Use custom BufReader impl for Ascii protocol

    The new impl performs better by potentially reducing allocations. Benchmark setup here: https://github.com/letmutx/line-reader/

    Benchmarks (take it with a grain of salt)

    $ cargo +nightly bench
    running 2 tests
    test tests::bench_reader  ... bench:     129,350 ns/iter (+/- 1,025,945)
    test tests::bench_reader2 ... bench:     135,599 ns/iter (+/- 1,225,536)
    
    opened by letmutx 4
  • Recreate Connection object when there are errors

    Recreate Connection object when there are errors

    In cases when there's a protocol error, we cannot use the underlying connection anymore because some bytes may be left out in the underlying connection. For the client to automatically recover from these class of errors, we should recreate a connection before we send the next request.

    We need not do this for all errors. Only some types of errors like IOError, ClientError(except KeyTooLong), ServerError. We need not do this for CommandErrors.

    @aisk What do you think about this?

    enhancement 
    opened by letmutx 4
  • Connect timeout always 30s

    Connect timeout always 30s

    TL;DR: is there anyway to set a connect timeout other than 30s?

    Simple program:

    let client = memcache::Client::connect("memcache+tcp://127.0.0.1:1234?timeout=5").unwrap();
    

    doesn't panic if there is a server on that port, otherwise:

    thread 'mytest' panicked at 'called `Result::unwrap()` on an `Err` value: PoolError(Error(Some("Connection refused (os error 111)")))', tests/tests.rs:21:87
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    It always seems to take exactly 30s to timeout. I thought it was because on this line

    https://github.com/aisk/rust-memcache/blob/master/src/connection.rs#L204

    connect is being used instead of connect_timeout. Probably because connect_timeout doesn't work unless there is a single address? My (probably ammeter) attempt to get it to use connect_timeout for a single address gave the same result: connect timeout of 30s

    diff --git a/src/connection.rs b/src/connection.rs
    index 8fe2e5d..cd372d6 100644
    --- a/src/connection.rs
    +++ b/src/connection.rs
    @@ -201,7 +201,11 @@ impl Transport {
     }
     
     fn tcp_stream(url: &Url, opts: &TcpOptions) -> Result<TcpStream, MemcacheError> {
    -    let tcp_stream = TcpStream::connect(&*url.socket_addrs(|| None)?)?;
    +    let addr = &*url.socket_addrs(|| None)?;
    +    let tcp_stream = match opts.timeout {
    +        Some(timeout) if addr.len() == 1 => TcpStream::connect_timeout(unsafe { addr.get_unchecked(0) }, timeout)?,
    +        _ => panic!("here"), //TcpStream::connect(addr)?,
    +    };
         if opts.timeout.is_some() {
             tcp_stream.set_read_timeout(opts.timeout)?;
             tcp_stream.set_write_timeout(opts.timeout)?;
    
    opened by plicease 3
  • Idiomatic usage of `ProtocolTrait` for `enum_dispatch`

    Idiomatic usage of `ProtocolTrait` for `enum_dispatch`

    @kaj brought to my attention in #115 that memcache is using an unintended side effect of enum_dispatch, which caused some issues after v0.2.3 was released. Those changes have been rolled back and re-released in v0.3.0, but it would be good to update the implementation here as well.

    Essentially, this PR just directly implements ProtocolTrait for AsciiProtocol<Stream> and BinaryProtocol by moving the corresponding methods 1-to-1 into the corresponding impl block. That allows them to benefit from Rust's trait semantics.

    opened by antonok-edm 3
  • Latest release (0.14.0) fails to build

    Latest release (0.14.0) fails to build

    Adding memcache 0.14.0 as a dependency causes build to fail with lots of messages like "the trait bound protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait is not satisfied", making it impossible to use memcache with the currently stable rust toolchain.

    This seems to be a dependency compatibility problem.

    Cargo toml
    [package]
    name = "t"
    version = "0.1.0"
    authors = ["Rasmus Kaj <[email protected]>"]
    edition = "2018"
    
    [dependencies]
    memcache = "0.14.0"
    
    
    Build log
       Compiling memcache v0.14.0
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
       | |     ------^-------------------------------------------------------------------------
       | |_____|_____|
       |       |     the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::auth`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
       | |     ------^-------------------------------------------------------------------------
       | |_____|_____|
       |       |     the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::auth`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
       | |     ---------^---------------------------------------------
       | |_____|________|
       |       |        the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::version`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
       | |     ---------^---------------------------------------------
       | |_____|________|
       |       |        the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::version`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
       | |     -------^-----------------------------------------
       | |_____|______|
       |       |      the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::flush`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
       | |     -------^-----------------------------------------
       | |_____|______|
       |       |      the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::flush`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    35 | |     fn flush_with_delay(&mut self, delay: u32) -> Result<(), MemcacheError>;
       | |     ------------------^-----------------------------------------------------
       | |_____|_________________|
       |       |                 the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::flush_with_delay`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    35 | |     fn flush_with_delay(&mut self, delay: u32) -> Result<(), MemcacheError>;
       | |     ------------------^-----------------------------------------------------
       | |_____|_________________|
       |       |                 the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::flush_with_delay`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    35 | |     fn flush_with_delay(&mut self, delay: u32) -> Result<(), MemcacheError>;
    36 | |     fn get<V: FromMemcacheValueExt>(&mut self, key: &str) -> Result<Option<V>, MemcacheError>;
       | |        --^ - required by this bound in `protocol::ProtocolTrait::get`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    35 | |     fn flush_with_delay(&mut self, delay: u32) -> Result<(), MemcacheError>;
    36 | |     fn get<V: FromMemcacheValueExt>(&mut self, key: &str) -> Result<Option<V>, MemcacheError>;
       | |        --^ - required by this bound in `protocol::ProtocolTrait::get`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    35 | |     fn flush_with_delay(&mut self, delay: u32) -> Result<(), MemcacheError>;
    36 | |     fn get<V: FromMemcacheValueExt>(&mut self, key: &str) -> Result<Option<V>, MemcacheError>;
    37 | |     fn gets<V: FromMemcacheValueExt>(&mut self, keys: &[&str]) -> Result<HashMap<String, V>, MemcacheError>;
       | |        ---^ - required by this bound in `protocol::ProtocolTrait::gets`
       | |___________|
       |             the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    35 | |     fn flush_with_delay(&mut self, delay: u32) -> Result<(), MemcacheError>;
    36 | |     fn get<V: FromMemcacheValueExt>(&mut self, key: &str) -> Result<Option<V>, MemcacheError>;
    37 | |     fn gets<V: FromMemcacheValueExt>(&mut self, keys: &[&str]) -> Result<HashMap<String, V>, MemcacheError>;
       | |        ---^ - required by this bound in `protocol::ProtocolTrait::gets`
       | |___________|
       |             the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    37 | |     fn gets<V: FromMemcacheValueExt>(&mut self, keys: &[&str]) -> Result<HashMap<String, V>, MemcacheError>;
    38 | |     fn set<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
       | |        --^ - required by this bound in `protocol::ProtocolTrait::set`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    37 | |     fn gets<V: FromMemcacheValueExt>(&mut self, keys: &[&str]) -> Result<HashMap<String, V>, MemcacheError>;
    38 | |     fn set<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
       | |        --^ - required by this bound in `protocol::ProtocolTrait::set`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    38 | |     fn set<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
    39 | |     fn cas<V: ToMemcacheValue<Stream>>(
       | |        --^ - required by this bound in `protocol::ProtocolTrait::cas`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    38 | |     fn set<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
    39 | |     fn cas<V: ToMemcacheValue<Stream>>(
       | |        --^ - required by this bound in `protocol::ProtocolTrait::cas`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    45 | |     ) -> Result<bool, MemcacheError>;
    46 | |     fn add<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
       | |        --^ - required by this bound in `protocol::ProtocolTrait::add`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    45 | |     ) -> Result<bool, MemcacheError>;
    46 | |     fn add<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
       | |        --^ - required by this bound in `protocol::ProtocolTrait::add`
       | |__________|
       |            the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    46 | |     fn add<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
    47 | |     fn replace<V: ToMemcacheValue<Stream>>(
       | |        ------^ - required by this bound in `protocol::ProtocolTrait::replace`
       | |______________|
       |                the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    46 | |     fn add<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V, expiration: u32) -> Result<(), MemcacheError>;
    47 | |     fn replace<V: ToMemcacheValue<Stream>>(
       | |        ------^ - required by this bound in `protocol::ProtocolTrait::replace`
       | |______________|
       |                the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    52 | |     ) -> Result<(), MemcacheError>;
    53 | |     fn append<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
       | |        -----^ - required by this bound in `protocol::ProtocolTrait::append`
       | |_____________|
       |               the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    52 | |     ) -> Result<(), MemcacheError>;
    53 | |     fn append<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
       | |        -----^ - required by this bound in `protocol::ProtocolTrait::append`
       | |_____________|
       |               the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    53 | |     fn append<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
    54 | |     fn prepend<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
       | |        ------^ - required by this bound in `protocol::ProtocolTrait::prepend`
       | |______________|
       |                the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    53 | |     fn append<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
    54 | |     fn prepend<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
       | |        ------^ - required by this bound in `protocol::ProtocolTrait::prepend`
       | |______________|
       |                the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    54 | |     fn prepend<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
    55 | |     fn delete(&mut self, key: &str) -> Result<bool, MemcacheError>;
       | |     --------^------------------------------------------------------
       | |_____|_______|
       |       |       the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::delete`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    54 | |     fn prepend<V: ToMemcacheValue<Stream>>(&mut self, key: &str, value: V) -> Result<(), MemcacheError>;
    55 | |     fn delete(&mut self, key: &str) -> Result<bool, MemcacheError>;
       | |     --------^------------------------------------------------------
       | |_____|_______|
       |       |       the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::delete`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    55 | |     fn delete(&mut self, key: &str) -> Result<bool, MemcacheError>;
    56 | |     fn increment(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
       | |     -----------^------------------------------------------------------------------
       | |_____|__________|
       |       |          the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::increment`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    55 | |     fn delete(&mut self, key: &str) -> Result<bool, MemcacheError>;
    56 | |     fn increment(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
       | |     -----------^------------------------------------------------------------------
       | |_____|__________|
       |       |          the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::increment`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    56 | |     fn increment(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
    57 | |     fn decrement(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
       | |     -----------^------------------------------------------------------------------
       | |_____|__________|
       |       |          the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::decrement`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    56 | |     fn increment(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
    57 | |     fn decrement(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
       | |     -----------^------------------------------------------------------------------
       | |_____|__________|
       |       |          the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::decrement`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    57 | |     fn decrement(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
    58 | |     fn touch(&mut self, key: &str, expiration: u32) -> Result<bool, MemcacheError>;
       | |     -------^-----------------------------------------------------------------------
       | |_____|______|
       |       |      the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::touch`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    57 | |     fn decrement(&mut self, key: &str, amount: u64) -> Result<u64, MemcacheError>;
    58 | |     fn touch(&mut self, key: &str, expiration: u32) -> Result<bool, MemcacheError>;
       | |     -------^-----------------------------------------------------------------------
       | |_____|______|
       |       |      the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::touch`
    
    error[E0277]: the trait bound `protocol::ascii::AsciiProtocol<stream::Stream>: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    58 | |     fn touch(&mut self, key: &str, expiration: u32) -> Result<bool, MemcacheError>;
    59 | |     fn stats(&mut self) -> Result<Stats, MemcacheError>;
       | |     -------^--------------------------------------------
       | |_____|______|
       |       |      the trait `protocol::ProtocolTrait` is not implemented for `protocol::ascii::AsciiProtocol<stream::Stream>`
       |       required by `protocol::ProtocolTrait::stats`
    
    error[E0277]: the trait bound `protocol::binary::BinaryProtocol: protocol::ProtocolTrait` is not satisfied
      --> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/memcache-0.14.0/src/protocol/mod.rs:31:11
       |
    31 |   pub trait ProtocolTrait {
       |  ___________^
    32 | |     fn auth(&mut self, username: &str, password: &str) -> Result<(), MemcacheError>;
    33 | |     fn version(&mut self) -> Result<String, MemcacheError>;
    34 | |     fn flush(&mut self) -> Result<(), MemcacheError>;
    ...  |
    58 | |     fn touch(&mut self, key: &str, expiration: u32) -> Result<bool, MemcacheError>;
    59 | |     fn stats(&mut self) -> Result<Stats, MemcacheError>;
       | |     -------^--------------------------------------------
       | |_____|______|
       |       |      the trait `protocol::ProtocolTrait` is not implemented for `protocol::binary::BinaryProtocol`
       |       required by `protocol::ProtocolTrait::stats`
    
    error: aborting due to 34 previous errors
    
    For more information about this error, try `rustc --explain E0277`.
    error: could not compile `memcache`.
    
    To learn more, run the command again with --verbose.
    
    
    opened by kaj 3
  • Applied consistent hashing as a default function

    Applied consistent hashing as a default function

    This is to enable consistent hashing to get a server for a key statically. There is already an issue about this raised at https://github.com/aisk/rust-memcache/issues/33. Tests are included but I will add more if necessary. I will add features on this to fully utilize this function like decreasing and increasing the number of nodes.

    opened by nishidy 0
  • get vs gets

    get vs gets

    It appears that the get and gets commands implemented in this crate differ slightly from the protocol

    The get method should take one or more keys. The gets method is about returning the current CAS value as part of the retrieval command and also operates on one or more keys.

    Please see the memcache protocol spec for the definition of these commands.

    If I'm understanding the implementation correctly, the gets method is correct and should also retrieve the CAS values, but the get method is not fully implemented as it should support requesting more than one key in a single call. I believe the current docs mistakenly direct users towards the gets function for multi-key retrieval even though that is not the difference between get and gets.

    opened by brayniac 0
  • Add a command line target which could be used as a memcached interactive tool

    Add a command line target which could be used as a memcached interactive tool

    We can add a subfolder and marks it as bin in Cargo.toml, so that we can build a executable with cargo build or cargo install. There is an example: https://github.com/shadowsocks/shadowsocks-rust/blob/master/Cargo.toml

    So that we can add a target called memcache-cli, for people can install it with cargo install, and use it as a command line tool to operate memcached data.

    enhancement 
    opened by aisk 0
  • Pipeline Operations

    Pipeline Operations

    This PR adds set_multi() and delete_multi() methods, which use pipelining to reduce the number of server round trips when setting or deleting multiple keys. The new methods accept generic collection arguments. For example, set_multi() accepts a HashMap or Vec of many types of strings.

    This PR also adds get_multi() and changes client.gets() to use get_multi(), so that users of get_multi() can also benefit from the generic collection arguments.

    Tests included.

    opened by hathawsh 12
  • Optimize numeric value serialization/deserialization

    Optimize numeric value serialization/deserialization

    We call num.to_string().as_bytes() to serialize and deserialize numbers when setting them in memcache server. Instead, we could use byteorder crate's read_u16, read_u64 etc. and write out the bytes to the server with a specific endianness(big/little) and use the same when deserializing. deserialization: https://github.com/aisk/rust-memcache/blob/faed4e117b8108dbcae1901c891844009229190e/src/value.rs#L161 serialization: https://github.com/aisk/rust-memcache/blob/faed4e117b8108dbcae1901c891844009229190e/src/value.rs#L95 https://github.com/aisk/rust-memcache/blob/faed4e117b8108dbcae1901c891844009229190e/src/value.rs#L91

    enhancement good-first-issue 
    opened by letmutx 0
Owner
An Long
茍利國家生死以 豈因禍福避趨之
An Long
Rust binary memcached implementation

bmemcached-rs Rust binary memcached implementation (ON GOING) Usage extern crate bmemcached; use std::sync::Arc; use std::thread; use bmemcached::Me

Jayson Reis 25 Jun 15, 2022
Rust cache structures and easy function memoization

cached Caching structures and simplified function memoization cached provides implementations of several caching structures as well as a handy macro f

James Kominick 996 Jan 7, 2023
This is a Rust implementation for HashiCorp's golang-lru. This crate contains three LRU based cache, LRUCache, TwoQueueCache and AdaptiveCache.

This is a Rust implementation for HashiCorp's golang-lru. This crate contains three LRU based cache, LRUCache, TwoQueueCache and AdaptiveCache.

Al Liu 84 Jan 3, 2023
This is a Rust implementation for popular caches (support no_std).

Caches This is a Rust implementation for popular caches (support no_std). See Introduction, Installation and Usages for more details. English | 简体中文 I

Al Liu 83 Dec 11, 2022
A set of safe Least Recently Used (LRU) map/cache types for Rust

LruMap A set of safe Least-Recently-Used (LRU) cache types aimed at providing flexible map-like structures that automatically evict the least recently

Khonsu Labs 4 Sep 24, 2022
Rust type wrapper to cache hash of potentially large structures.

CachedHash For a type T, CachedHash<T> wraps T and implements Hash in a way that caches T's hash value. This is useful when T is expensive to hash (fo

pali 3 Dec 8, 2022
A generational arena based LRU Cache implementation in 100% safe rust.

generational-lru Crate providing a 100% safe, generational arena based LRU cache implementation. use generational_lru::lrucache::{LRUCache, CacheError

Arindam Das 37 Dec 21, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Meteor Client Installer - Installer to automate the install of Fabric and Meteor Client

This is an installer that automates the install of Meteor and Fabric

Jake Priddle 3 Jun 23, 2021
Provides a mock Ambi client that emulates real sensor hardware such as an Edge client

ambi_mock_client Provides a mock Ambi client that emulates real sensor hardware such as an Edge client. Usage You must have Rust installed to build am

Rust Never Sleeps 2 Apr 1, 2022
Affine-client is a client for AFFINE based on Tauri

Affine Client affine-client is a client for AFFINE based on Tauri Supported Platforms Windows Linux MacOS Download https://github.com/m1911star/affine

Horus 216 Dec 25, 2022
Acts as an IRC server and a nostr client. Connect with your IRC client using your nostr private key as the password.

nostr-irc Acts as an IRC server and a nostr client. Connect with your IRC client using your nostr private key as the password. Experimental code, use

null 11 Dec 26, 2022
Rust/Axum server implementation with PCR(Prisma Client Rust)

Realworld Rust Axum Prisma This project utilizes Rust with the Axum v0.7 framework along with the Prisma Client Rust to build a realworld application.

Neo 3 Dec 9, 2023
Coinbase pro client for Rust

Coinbase pro client for Rust Supports SYNC/ASYNC/Websocket-feed data support Features private and public API sync and async support websocket-feed sup

null 126 Dec 30, 2022
Rust Ethereum 2.0 Client

Lighthouse: Ethereum 2.0 An open-source Ethereum 2.0 client, written in Rust and maintained by Sigma Prime. Documentation Overview Lighthouse is: Read

Sigma Prime 2.1k Jan 6, 2023
rust client libraries to deal with the current cardano mainnet (byron / cardano-sl)

Rust implementation of Cardano primitives, helpers, and related applications Cardano Rust is a modular toolbox of Cardano’s cryptographic primitives,

Input Output 275 Oct 9, 2022
A client and server implementation of the OPC UA specification written in Rust

Introduction This is an OPC UA server / client API implementation for Rust. Linux Windows OPC UA is an industry standard for monitoring of data. It's

null 362 Dec 30, 2022
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. ?? Looking for an async version? async-std https://github.c

Alex Pikalov 338 Jan 1, 2023
CouchDB client-side library for the Rust programming language

Chill Chill is a client-side CouchDB library for the Rust programming language, available on crates.io. It targets Rust Stable. Chill's three chief de

null 35 Jun 26, 2022
A Rust client for the ElasticSearch REST API

rs-es Introduction An ElasticSearch client for Rust via the REST API. Targetting ElasticSearch 2.0 and higher. Other clients For later versions of Ela

Ben Ashford 218 Dec 27, 2022