redis-rs v0.11.0-beta.1 Release Notes

Release Date: 2019-05-30 // almost 5 years ago
  • ๐Ÿ›  Fixes and improvements

    • (async) Simplify implicit pipeline handling (#182)
    • (async) Use tokio_sync's channels instead of futures (#195)
    • (async) Only allocate one oneshot per request (#194)
    • โœ‚ Remove redundant BufReader when parsing (#197)
    • ๐Ÿ“œ Hide actual type returned from async parser (#193)
    • ๐Ÿ“œ Use more performant operations for line parsing (#198)
    • ๐Ÿ’ฅ Optimize the command encoding, see below for breaking changes (#165)
    • โž• Add support for geospatial commands (#130)
    • ๐Ÿ‘ (async) Add support for async Script invocation (#206)

    ๐Ÿ’ฅ BREAKING CHANGES

    ๐Ÿ“‡ Renamed the async module to aio (#189)

    async is a reserved keyword in Rust 2018, so this avoids the need to write r#async in it.

    Old code:

    use redis::async::SharedConnection;
    

    ๐Ÿ†• New code:

    use redis::aio::SharedConnection;
    

    The trait ToRedisArgs was changed (#165)

    ToRedisArgs has been changed to take take an instance of RedisWrite instead of Vec<Vec<u8>>. Use the write_arg method instead of Vec::push.

    Minimum Rust version is now 1.26 (#165)

    โฌ†๏ธ Upgrade your compiler. impl Iterator is used, requiring a more recent version of the Rust compiler.

    iter now takes self by value (#165)

    iter now takes self by value instead of cloning self inside the method.

    Old code:

    let mut iter : redis::Iter<isize> = cmd.arg("my_set").cursor_arg(0).iter(&con).unwrap();
    

    ๐Ÿ†• New code:

    let mut iter : redis::Iter<isize> = cmd.arg("my_set").cursor_arg(0).clone().iter(&con).unwrap();
    

    ๐Ÿ‘ฏ (The above line calls clone().)

    A mutable connection object is now required (#148)

    ๐Ÿšš We removed the internal usage of RefCell and Cell and instead require a mutable reference, &mut ConnectionLike, on all command calls.

    Old code:

    let client = redis::Client::open("redis://127.0.0.1/")?;
    let con = client.get_connection()?;
    redis::cmd("SET").arg("my_key").arg(42).execute(&con);
    

    ๐Ÿ†• New code:

    let client = redis::Client::open("redis://127.0.0.1/")?;
    let mut con = client.get_connection()?;
    redis::cmd("SET").arg("my_key").arg(42).execute(&mut con);
    

    Due to this, transaction has changed. The callback now also receives a mutable reference to the used connection.

    Old code:

    let client = redis::Client::open("redis://127.0.0.1/").unwrap();
    let con = client.get_connection().unwrap();
    let key = "the_key";
    let (new_val,) : (isize,) = redis::transaction(&con, &[key], |pipe| {
        let old_val : isize = con.get(key)?;
        pipe
            .set(key, old_val + 1).ignore()
            .get(key).query(&con)
    })?;
    

    ๐Ÿ†• New code:

    let client = redis::Client::open("redis://127.0.0.1/").unwrap();
    let mut con = client.get_connection().unwrap();
    let key = "the_key";
    let (new_val,) : (isize,) = redis::transaction(&mut con, &[key], |con, pipe| {
        let old_val : isize = con.get(key)?;
        pipe
            .set(key, old_val + 1).ignore()
            .get(key).query(&con)
    })?;
    

    โœ‚ Remove rustc-serialize feature (#200)

    ๐Ÿšš We removed serialization to/from JSON. The underlying library is deprecated for a long time.

    Old code in Cargo.toml:

    [dependencies.redis]
    version = "0.9.1"
    features = ["with-rustc-json"]
    

    There's no replacement for the feature. ๐Ÿ‘‰ Use serde and handle the serialization/deserialization in your own code.

    โœ‚ Remove with-unix-sockets feature (#201)

    ๐Ÿšš We removed the Unix socket feature. It is now always enabled. ๐Ÿšš We also removed auto-detection.

    Old code in Cargo.toml:

    [dependencies.redis]
    version = "0.9.1"
    features = ["with-unix-sockets"]
    

    0๏ธโƒฃ There's no replacement for the feature. Unix sockets will continue to work by default.