Crate rcache [] [src]


rcache is a basic, featureless memory cache with a TCP frontend analogous to memcached. It is not production ready, and it's unlikely that it ever will be. Nevertheless, it is relatively performant and stable, and is a good example of what a naive developer can achieve with Rust.

TODOs include better benchmarks, more featureful clients (for rust and the command line), support for a more complete set of commands, and improving the binary protocol to at least include CRC checks.


  • Based on tokio
  • The TCP frontend speaks a multiplexed-binary protocol, detailed (poorly) in src/
  • Currently supports GET, SET, and DEL commands. CAS is conspicuously absent, but will be along eventually.
  • Storage is backed by an LRU cached based on a Linked Hash Map (provided by the lru-cache crate), all operations are threaded through a single worker, which has unsynchronized access to the store.


Start a server: cargo run -- server

Set a key: cargo run -- client SET foo bar

Get a key: cargo run -- client GET foo

Get stats: cargo run -- client STATS


I'm currently working on providing realistic benchmarks. Naive benchmarks show that rcache can handle around 50k/req/s with 2,000,000 keys in the cache. This benchmarking was done with 100 concurrent clients making 500 requests each. However, I've no doubt that there were numerous issues in my benchmarking methodology. Even so, it's neat that a weekend implementation project can get into the same ballpark as memcached.