All Projects → aisk → rust-memcache

aisk / rust-memcache

Licence: MIT license
memcache client for rust

Programming Languages

rust
11053 projects
shell
77523 projects

Projects that are alternatives of or similar to rust-memcache

memcache
Node.js memcached client with the most efficient ASCII protocol parser
Stars: ✭ 26 (-75.47%)
Mutual labels:  memcached, memcache
Xmemcached
High performance, easy to use multithreaded memcached client in java.
Stars: ✭ 715 (+574.53%)
Mutual labels:  memcached, memcache
mdserver-web
Simple Linux Panel
Stars: ✭ 1,064 (+903.77%)
Mutual labels:  memcached, memcache
go-elasticache
Thin abstraction over the Memcache client package gomemcache (https://github.com/bradfitz/gomemcache) allowing it to support AWS ElastiCache cluster nodes
Stars: ✭ 15 (-85.85%)
Mutual labels:  memcached, memcache
Cachego
Golang Cache component - Multiple drivers
Stars: ✭ 148 (+39.62%)
Mutual labels:  memcached, driver
memcached
Memcached Operator for Kubernetes
Stars: ✭ 18 (-83.02%)
Mutual labels:  memcached, memcache
Pymemcache
A comprehensive, fast, pure-Python memcached client.
Stars: ✭ 552 (+420.75%)
Mutual labels:  memcached, memcache
Memcache Info
Simple and efficient way to show information about Memcache.
Stars: ✭ 84 (-20.75%)
Mutual labels:  memcached, memcache
Wp Spider Cache
Your friendly neighborhood caching solution for WordPress
Stars: ✭ 133 (+25.47%)
Mutual labels:  memcached, memcache
Overlord
Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster的代理及集群管理功能,致力于提供自动化高可用的缓存服务解决方案。
Stars: ✭ 1,884 (+1677.36%)
Mutual labels:  memcached, memcache
Ninja Mutex
Mutex implementation for PHP
Stars: ✭ 180 (+69.81%)
Mutual labels:  memcached, memcache
Memjs
A memcache client for node using the binary protocol and SASL authentication
Stars: ✭ 161 (+51.89%)
Mutual labels:  memcached, memcache
Phpfastcache
A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
Stars: ✭ 2,171 (+1948.11%)
Mutual labels:  memcached, driver
aioch
aioch - is a library for accessing a ClickHouse database over native interface from the asyncio
Stars: ✭ 145 (+36.79%)
Mutual labels:  driver
BBear balance car
it'a mini auto balance car which use the mini motor to drive the car
Stars: ✭ 44 (-58.49%)
Mutual labels:  driver
tarantool-php
PECL PHP driver for Tarantool
Stars: ✭ 82 (-22.64%)
Mutual labels:  driver
serverless-examples-cached-rds-ws
A serverless framework example project that uses API Gateway, ElastiCache, and RDS PostgreSQL.
Stars: ✭ 45 (-57.55%)
Mutual labels:  memcached
fluent-provider
A provider for including Fluent in Vapor applications
Stars: ✭ 13 (-87.74%)
Mutual labels:  driver
rssd
Rohde & Schwarz SCPI Driver (in Python)
Stars: ✭ 25 (-76.42%)
Mutual labels:  driver
realtek-uad-nahimic-mod
Realtek Universal Audio Driver with Nahimic APO
Stars: ✭ 55 (-48.11%)
Mutual labels:  driver

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].