Changelog History
Page 5
-
v3.0.7 Changes
➕ Added method
Redis#dup
to duplicate a Redis connection.👍 IPv6 support.
-
v3.0.6 Changes
- ➕ Added support for
SCAN
and variants.
- ➕ Added support for
-
v3.0.5 Changes
🛠 Fix calling #select from a pipeline (#309).
➕ Added method
Redis#connected?
.➕ Added support for
MIGRATE
(Redis 2.6).👌 Support extended SET command (#343, thanks to @benubois).
-
v3.0.4 Changes
Ensure #watch without a block returns "OK" (#332).
👉 Make futures identifiable (#330).
🛠 Fix an issue preventing STORE in a SORT with multiple GETs (#328).
-
v3.0.3 Changes
Blocking list commands (
BLPOP
,BRPOP
,BRPOPLPUSH
) use a socket timeout equal to the sum of the command's timeout and the Redis client's timeout, instead of disabling socket timeout altogether.💎 Ruby 2.0 compatibility.
➕ Added support for
DUMP
andRESTORE
(Redis 2.6).➕ Added support for
BITCOUNT
andBITOP
(Redis 2.6).Call
#to_s
on value argument forSET
,SETEX
,PSETEX
,GETSET
,SETNX
, andSETRANGE
.
-
v3.0.2 Changes
Unescape CGI escaped password in URL.
🛠 Fix test to check availability of
UNIXSocket
.🛠 Fix handling of score = +/- infinity for sorted set commands.
Replace array splats with concatenation where possible.
Raise if
EXEC
returns an error.0️⃣ Passing a nil value in options hash no longer overwrites the default.
👍 Allow string keys in options hash passed to
Redis.new
orRedis.connect
.🛠 Fix uncaught error triggering unrelated error (synchrony driver).
See f7ffd5f1a628029691084de69e5b46699bb8b96d and #248.
-
v3.0.1 Changes
🛠 Fix reconnect logic not kicking in on a write error.
See 427dbd52928af452f35aa0a57b621bee56cdcb18 and #238.
-
v3.0.0 Changes
⬆️ Upgrading from 2.x to 3.0
The following items are the most important changes to review when ⬆️ upgrading from redis-rb 2.x. A full list of changes can be found below.
The methods for the following commands have changed the arguments they take, their return value, or both.
BLPOP
,BRPOP
,BRPOPLPUSH
SORT
MSETNX
ZRANGE
,ZREVRANGE
,ZRANGEBYSCORE
,ZREVRANGEBYSCORE
ZINCRBY
,ZSCORE
The return value from
#pipelined
and#multi
no longer contains unprocessed replies, but the same replies that would be returned if the command had not been executed in these blocks.The client raises custom errors on connection errors, instead of
RuntimeError
and errors in theErrno
family.
🔄 Changes
➕ Added support for scripting commands (Redis 2.6).
Scripts can be executed using
#eval
and#evalsha
. Both can commands can either take two arrays to specifyKEYS
andARGV
, or take a hash containing:keys
and:argv
to specifyKEYS
andARGV
.redis.eval("return ARGV[1] * ARGV[2]", :argv => [2, 3]) # => 6
Subcommands of the
SCRIPT
command can be executed via the#script
method.For example:
redis.script(:load, "return ARGV[1] * ARGV[2]") # => "58db5d365a1922f32e7aa717722141ea9c2b0cf3" redis.script(:exists, "58db5d365a1922f32e7aa717722141ea9c2b0cf3") # => true redis.script(:flush) # => "OK"
The repository now lives at https://github.com/redis/redis-rb. Thanks, Ezra!
➕ Added support for
PEXPIRE
,PEXPIREAT
,PTTL
,PSETEX
,INCRYBYFLOAT
,HINCRYBYFLOAT
andTIME
(Redis 2.6).Redis.current
is now thread unsafe, because the client itself is thread safe.In the future you'll be able to do something like:
Redis.current = Redis::Pool.connect
This makes
Redis.current
actually usable in multi-threaded environments, while not affecting those running a single thread.🔄 Change API for
BLPOP
,BRPOP
andBRPOPLPUSH
.Both
BLPOP
andBRPOP
now take a single argument equal to a string key, or an array with string keys, followed by an optional hash with a:timeout
key. When not specified, the timeout defaults to0
to not time out.redis.blpop(["list1", "list2"], :timeout => 1.0)
BRPOPLPUSH
also takes an optional hash with a:timeout
key as last argument for consistency. When not specified, the timeout defaults to0
to not time out.redis.brpoplpush("some_list", "another_list", :timeout => 1.0)
When
SORT
is passed multiple key patterns to get via the:get
option, it now returns an array per result element, holding allGET
substitutions.The
MSETNX
command now returns a boolean.The
ZRANGE
,ZREVRANGE
,ZRANGEBYSCORE
andZREVRANGEBYSCORE
commands now return an array containing[String, Float]
pairs when:with_scores => true
is passed.For example:
redis.zrange("zset", 0, -1, :with_scores => true) # => [["foo", 1.0], ["bar", 2.0]]
The
ZINCRBY
andZSCORE
commands now return aFloat
score instead of a string holding a representation of the score.The client now raises custom exceptions where it makes sense.
If by any chance you were rescuing low-level exceptions (
Errno::*
), you should now rescue as follows:Errno::ECONNRESET -> Redis::ConnectionError Errno::EPIPE -> Redis::ConnectionError Errno::ECONNABORTED -> Redis::ConnectionError Errno::EBADF -> Redis::ConnectionError Errno::EINVAL -> Redis::ConnectionError Errno::EAGAIN -> Redis::TimeoutError Errno::ECONNREFUSED -> Redis::CannotConnectError
Always raise exceptions originating from erroneous command invocation inside pipelines and MULTI/EXEC blocks.
The old behavior (swallowing exceptions) could cause application bugs to go unnoticed.
Implement futures for assigning values inside pipelines and MULTI/EXEC blocks. Futures are assigned their value after the pipeline or MULTI/EXEC block has executed.
$redis.pipelined do @future = $redis.get "key" end puts @future.value
💎 Ruby 1.8.6 is officially not supported.
👌 Support
ZCOUNT
inRedis::Distributed
(Michael Dungan).Pipelined commands now return the same replies as when called outside a pipeline.
In the past, pipelined replies were returned without post-processing.
👌 Support
SLOWLOG
command (Michael Bernstein).Calling
SHUTDOWN
effectively disconnects the client (Stefan Kaes).👍 Basic support for mapping commands so that they can be renamed on the server.
Connecting using a URL now checks that a host is given.
It's just a small sanity check, cf. #126
👌 Support variadic commands introduced in Redis 2.4.
-
v2.2.2 Changes
- ➕ Added method
Redis::Distributed#hsetnx
.
- ➕ Added method
-
v2.2.1 Changes
Internal API: Client#call and family are now called with a single array argument, since splatting a large number of arguments (100K+) results in a stack overflow on 1.9.2.
The
INFO
command can optionally take a subcommand. When the subcommand isCOMMANDSTATS
, the client will properly format the returned statistics per command. Subcommands forINFO
are available since Redis v2.3.0 (unstable).🔄 Change
IO#syswrite
back to the bufferedIO#write
since some Rubies do short writes for large (1MB+) buffers and some don't (see issue #108).