github redis-rs/redis-rs 0.11.0
v0.11.0

latest releases: redis-0.25.3, redis-0.25.2, redis-0.25.1...
4 years ago

This release includes all fixes & improvements from the two beta releases listed below.
This release contains breaking changes.

Fixes and improvements

  • (async) Fix performance problem for SharedConnection (#222)
  • (async) Don't block the executor from shutting down (#217)
  • (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"]

There's no replacement for the feature. Unix sockets will continue to work by default.

Don't miss a new redis-rs release

NewReleases is sending notifications on new releases.