Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaysonsantos/bmemcached-rs
Rust binary memcached implementation
https://github.com/jaysonsantos/bmemcached-rs
memcached rust-library
Last synced: 7 days ago
JSON representation
Rust binary memcached implementation
- Host: GitHub
- URL: https://github.com/jaysonsantos/bmemcached-rs
- Owner: jaysonsantos
- License: mit
- Archived: true
- Created: 2016-03-24T08:30:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T10:52:15.000Z (about 6 years ago)
- Last Synced: 2024-10-06T18:45:40.478Z (28 days ago)
- Topics: memcached, rust-library
- Language: Rust
- Homepage:
- Size: 3.52 MB
- Stars: 26
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-cn - jaysonsantos/bmemcached-rs - ci.org/jaysonsantos/bmemcached-rs.svg?branch=master">](https://travis-ci.org/jaysonsantos/bmemcached-rs) (Libraries / Caching)
- awesome-rust - jaysonsantos/bmemcached-rs - ci.org/jaysonsantos/bmemcached-rs.svg?branch=master">](https://travis-ci.org/jaysonsantos/bmemcached-rs) (Libraries / Caching)
- awesome-rust-zh - jaysonsantos/bmemcached-rs - 用纯螃蟹写的 Memcached 库[<img src="https://api.travis-ci.org/jaysonsantos/bmemcached-rs.svg?branch=master">](https://travis-ci.org/jaysonsantos/bmemcached-rs) (库 / 高速缓存)
- awesome-rust - jaysonsantos/bmemcached-rs - ci.org/jaysonsantos/bmemcached-rs.svg?branch=master">](https://travis-ci.org/jaysonsantos/bmemcached-rs) (库 Libraries / 缓存 Caching)
README
# bmemcached-rs
[![Build Status](https://travis-ci.org/jaysonsantos/bmemcached-rs.svg?branch=master)](https://travis-ci.org/jaysonsantos/bmemcached-rs)
[![Build status](https://ci.appveyor.com/api/projects/status/ile6fh5ro8so2ctm/branch/master?svg=true)](https://ci.appveyor.com/project/jaysonsantos/bmemcached-rs/branch/master)Rust binary memcached implementation (ON GOING)
# Usage
```rust
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.