mitsuhiko/redis-rs


Redis library for rust

https://docs.rs/redis

License: Other

Language: Rust


redis-rs

Build Status crates.io

Redis-rs is a high level redis library for Rust. It provides convenient access to all Redis functionality through a very flexible but low-level API. It uses a customizable type conversion trait so that any operation can return results in just the type you are expecting. This makes for a very pleasant development experience.

The crate is called redis and you can depend on it via cargo:

[dependencies]
redis = "0.10.0"

Documentation on the library can be found at docs.rs/redis.

Note: redis-rs requires at least Rust 1.26.

Basic Operation

To open a connection you need to create a client and then to fetch a connection from it. In the future there will be a connection pool for those, currently each connection is separate and not pooled.

Many commands are implemented through the Commands trait but manual command creation is also possible.

extern crate redis;
use redis::Commands;

fn fetch_an_integer() -> redis::RedisResult<isize> {
    // connect to redis
    let client = redis::Client::open("redis://127.0.0.1/")?;
    let con = client.get_connection()?;
    // throw away the result, just make sure it does not fail
    let _ : () = con.set("my_key", 42)?;
    // read back the key and return it.  Because the return value
    // from the function is a result for integer this will automatically
    // convert into one.
    con.get("my_key")
}

Development

If you want to develop on the library there are a few commands provided by the makefile:

To build:

$ make

To test:

$ make test

To run benchmarks:

$ make bench

To build the docs:

$ make docs

Project Statistics

Sourcerank 14
Repository Size 1.4 MB
Stars 1,131
Forks 164
Watchers 32
Open issues 21
Dependencies 12
Contributors 47
Tags 25
Created
Last updated
Last pushed

Top Contributors See all

Armin Ronacher Jan-Erik Rediger Markus Westerlind Ayose Cazorla Joe Wilm Evan Schwartz Noam Meltzer harrydevnull Dominik Sander Astro Frank Denis Bastien Orivel Jakub Laurent Arnoud Alexander Polakov Andrew Tulloch Jake Goulding Tony Issakov hadashiA Ricardo Mendes

Packages Referencing this Repo

redis
Redis driver for Rust.
Latest release 0.11.0 - Updated - 1.13K stars

Recent Tags See all

0.11.0 July 19, 2019
0.11.0-beta.2 July 14, 2019
0.11.0-beta.1 May 30, 2019
0.10.0 February 19, 2019
0.9.1 September 10, 2018
0.9.0 August 08, 2018
0.8.0 December 26, 2016
0.7.1 December 16, 2016
0.7.0 July 23, 2016
0.6.0 July 13, 2016
0.5.4 June 25, 2016
0.5.3 May 02, 2016
0.5.2 December 10, 2015
0.5.1 October 07, 2015
0.5.0 July 27, 2015

Interesting Forks See all

jedisct1/redis-rs
Redis library for rust
Rust - BSD-3-Clause - Last pushed - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2019-07-19 10:08:50 UTC

Login to resync this repository