3 releases

0.1.2 Dec 27, 2020
0.1.1 Dec 21, 2020
0.1.0 Dec 19, 2020

#2687 in Database interfaces

MIT license

68KB
1.5K SLoC

redis-rs

ci

Redis client for Rust.

  • Pure Rust, and doesn't depend on any 3rd party libraries

Cargo.toml

[dependencies.redisclient]
version = "*"

src/main.rs

extern crate redisclient;

use redisclient::RedisResult;
use redisclient::RedisClient;

fn main() {
    if let Err(e) = run() {
        println!("Error -> {}", e);
    }
}

fn run() -> RedisResult<()> {
    let mut client = RedisClient::new()?;
    client.mset(vec![("key1", 1), ("key2", 2)])?;

    let values: Vec<String> = client.mget(vec!["key1", "key2"])?;
    println!("values -> {:?}", values);

    let values: Vec<isize> = client.mget(vec!["key1", "key2"])?;
    println!("values -> {:?}", values);

    Ok(())
}

lib.rs:

[dependencies.redisclient]
version = "*"

If you want use the Git version:

[dependencies.redisclient]
git = "https://github.com/ltoddy/redis-rs.git"

simple usage

extern crate redisclient;

use redisclient::RedisResult;
use redisclient::RedisClient;

fn run() -> RedisResult<()> {
    let mut client = RedisClient::new()?;
    client.mset(vec![("key1", 1), ("key2", 2)])?;

    let values: Vec<String> = client.mget(vec!["key1", "key2"])?;
    println!("values -> {:?}", values);

    let values: Vec<isize> = client.mget(vec!["key1", "key2"])?;
    println!("values -> {:?}", values);

    Ok(())
}

No runtime deps