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 writer#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 ofRedisWrite
instead ofVec<Vec<u8>>
. Use thewrite_arg
method instead ofVec::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 takesself
by value (#165)iter
now takesself
by value instead of cloningself
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
andCell
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.