Rust binary memcached implementation

Overview

bmemcached-rs

Build Status Build status

Rust binary memcached implementation (ON GOING)

Usage

extern crate bmemcached;

use std::sync::Arc;
use std::thread;

use bmemcached::MemcachedClient;

fn main() {
    // Use arc for threading support
    let client = Arc::new(MemcachedClient::new(vec!["127.0.0.1:11211"], 5).unwrap());

    // Traits examples
    let value = "value";
    client.set("string", value, 1000);
    let rv: String = client.get("string").unwrap();
    assert_eq!(rv, "value");

    client.set("integer", 10 as u8, 1000);
    let rv: u8 = client.get("integer").unwrap();
    assert_eq!(rv, 10 as u8);

    // Threads example
    let mut threads = vec![];
    for i in 0..4 {
        let client = client.clone();
        threads.push(thread::spawn(move || {
            let data = format!("data_n{}", i);
            client.set(&data, &data, 100).unwrap();
            let val: String = client.get(&data).unwrap();
            client.delete(&data).unwrap();
            val
        }));
    }
    for (i, thread) in threads.into_iter().enumerate() {
        let result = thread.join();
        assert_eq!(result.unwrap(), format!("data_n{}", i));
    }
}

Why

I am trying to learn rust by reimplementing a python project that I wrote.

What works

  • Add
  • Set
  • Replace
  • Get
  • Delete
  • Increment
  • Decrement
  • Consistent Hashing
  • Threading Support

Trait usage

On all supported functions we use traits to be able to send any type of values to memcached.

You might also like...
Memcached support for the r2d2 connection pool (Rust)

Memcached support for the r2d2 connection pool (Rust)

A general-purpose distributed memory cache system compatible with Memcached

memcrsd memcached server implementation in Rust memcrsd is a key value store implementation in Rust. It is compatible with binary protocol of memcache

mtop: top for Memcached
mtop: top for Memcached

mtop mtop: top for Memcached. Features Display real-time statistics about your memcached servers such as Memory usage/limit Current/max connections Hi

Binary coverage tool without binary modification for Windows
Binary coverage tool without binary modification for Windows

Summary Mesos is a tool to gather binary code coverage on all user-land Windows targets without need for source or recompilation. It also provides an

Binary coverage tool without binary modification for Windows
Binary coverage tool without binary modification for Windows

Summary Mesos is a tool to gather binary code coverage on all user-land Windows targets without need for source or recompilation. It also provides an

A binary encoder / decoder implementation in Rust.
A binary encoder / decoder implementation in Rust.

Bincode A compact encoder / decoder pair that uses a binary zero-fluff encoding scheme. The size of the encoded object will be the same or smaller tha

Stalin Binary Search, Rust implementation
Stalin Binary Search, Rust implementation

Stalin Binary Search Idea is based on Stalin Sort It's alike binary search but any checking element which is not target one is eliminated. Complexity

Rust implementation of multi-index hashing for neighbor searches on binary codes in the Hamming space

mih-rs Rust implementation of multi-index hashing (MIH) for neighbor searches on binary codes in the Hamming space, described in the paper Norouzi, Pu

A binary encoder / decoder implementation in Rust.

Bincode A compact encoder / decoder pair that uses a binary zero-fluff encoding scheme. The size of the encoded object will be the same or smaller tha

Rust implementation of the Binary Canonical Serialization (BCS) format

Binary Canonical Serialization (BCS) BCS (formerly "Libra Canonical Serialization" or LCS) is a serialization format developed in the context of the D

Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.

Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y

Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

trust Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows Featur

I/O and binary data encoding for Rust

nue A collection of tools for working with binary data and POD structs in Rust. pod is an approach at building a safe interface for transmuting POD st

An impish, cross-platform binary parsing crate, written in Rust
An impish, cross-platform binary parsing crate, written in Rust

libgoblin Documentation https://docs.rs/goblin/ changelog Usage Goblin requires rustc 1.40.0. Add to your Cargo.toml [dependencies] goblin = "0.3" Fea

A Rust library for zero-allocation parsing of binary data.

Zero A Rust library for zero-allocation parsing of binary data. Requires Rust version 1.6 or later (requires stable libcore for no_std). See docs for

Some Rust bindings for Binary Ninja

Binary Ninja Rust Bindings Work in progress Rust bindings geared towards analysis. Features added as they come up. No promises anything works at this

write your next slideshow in rust 🦀, as a self-contained binary  📦.
write your next slideshow in rust 🦀, as a self-contained binary 📦.

🗣 bema Write your next slideshow in rust 🦀 , as a self-contained binary 📦 . 🦀 DSL See examples/basic.rs. 👀 frontends There are several ways you c

A new operating system kernel with Linux binary compatibility written in Rust.
A new operating system kernel with Linux binary compatibility written in Rust.

Kerla Kerla is a monolithic operating system kernel from scratch in Rust which aims to be compatible with the Linux ABI, that is, runs Linux binaries

An impish, cross-platform binary parsing crate, written in Rust
An impish, cross-platform binary parsing crate, written in Rust

libgoblin Documentation https://docs.rs/goblin/ changelog Usage Goblin requires rustc 1.40.0. Add to your Cargo.toml [dependencies] goblin = "0.4" Fea

Comments
  • Thoughts on using rustc-serialize and serde

    Thoughts on using rustc-serialize and serde

    Instead of declaring a custom trait for serializing, have you thought about using the two leading serializers for this? I'd be willing to take a stab at implementing that using optional features.

    I think using conditional compilation depending on the feature needed. Thoughts?

    opened by RandomInsano 2
  • Implement sugestions

    Implement sugestions

    • [x] On key, value calls use &str or AsRef (This would be able to coerse '&static str, String, Vec, Path, and slices) e.g.
    fn set_add_replace<K, V>(&self, command: Command, key: K, value: V, time: u32) ->
        Result<...> where K: AsRef<[u8]>, V: AsRef<[u8]>
    
    • [x] Use String::from_utf8 instead of str::from_utf8
    • [x] Use bitflags to implement flags
    opened by jaysonsantos 0
cargo search, built for caching binary artifacts, optimized for GitHub Actions

cargo-search2 A binary utility that provides a more convenient version of cargo search. Installation Grab pre-built binaries for your platform from th

Rain 2 Oct 12, 2021
Stretto is a Rust implementation for ristretto. A high performance memory-bound Rust cache.

Stretto is a Rust implementation for ristretto. A high performance memory-bound Rust cache.

Al Liu 310 Dec 29, 2022
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 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
A native stateless cache implementation.

fBNC fBNC, Blockchain Native Cache. A native stateless storage library for block chain. Its value is to improve the stability and security of online s

Findora Foundation 1 Jan 12, 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
memcache client for rust

rust-memcache rust-memcache is a memcached client written in pure rust. Install The crate is called memcache and you can depend on it via cargo: [depe

An Long 104 Dec 23, 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