6.1.1
Bug fixes
- Fix
subscribe,psubscribeandssubscribe(and their_with_timeoutforms) dropping a message or raisingRedisClient::ProtocolErrorwhen the message arrives in parts more than 50 ms apart, a regression in 6.1.0. Not fixed on thehiredis-clientdriver, which can still crash on such a message. (#1417)
6.1.0
New features
- Add the
BLESSkey-protection commands (Redis 8.12):bless_get,bless_set,bless_clear,bless_scanandbless_scan_each. OnRedis::Cluster,bless_scaniterates every shard the wayscandoes (requires redis-cluster-client 0.17.3).Redis::Distributedimplements all butbless_scan, whose cursor cannot span ring nodes; usebless_scan_eachthere. (#1395) - Add the set member expiration commands (Redis 8.12):
sexpire,spexpire,sexpireat,spexpireat,sttl,spttl,sexpiretime,spexpiretimeandspersist, with thenx:/xx:/gt:/lt:condition options, plussaddexwithmnx:/mxx:and theex:/px:/exat:/pxat:/keepttl:expiry options. All are available onRedis::Distributed. (#1405) - Add
zmove,bzmoveandzmovemember(Redis 8.12). Available onRedis::Distributed. (#1411) - Add
bitrangeintarray(Redis 8.12). Available onRedis::Distributed. (#1409) - Add the array commands (Redis 8.8):
arset,arget,armset,armget,argetrange,arlen,arcount,ardel,ardelrange,arinsert,arseek,arnext,arlastitems,arring,arscan,argrep,aropandarinfo. All are available onRedis::Distributed. (#1371) - Add
increxwithby:,lbound:/ubound:/saturate:and theex:/px:/exat:/pxat:/persist:/enx:expiry options, andxnack(Redis 8.8).increxis available onRedis::Distributed. (#1372) json_setnow acceptsfpha:to store a numeric array as a packed floating-point array, and the sorted set union/intersection commands acceptaggregate: "count"(Redis 8.8). (#1373)- Add keyspace notification support: channel builders and a binary-safe parser for the classic
__keyspace@*/__keyevent@*channels and the Redis 8.8 subkey notification families (Redis::KeyspaceNotifications), plus a manager (Redis#keyspace_notifications) that owns a dedicated connection, dispatches typedNotificationobjects to handlers, and automatically re-subscribes after connection loss (on_reconnectsignals the lossy gap). Enablingnotify-keyspace-eventson the server remains the operator's responsibility. Not supported byRedis::Distributed. See specs/keyspace-notifications/user-guide.md. (#1375) - Add the hot key tracking commands (Redis 8.6):
hotkeys_start,hotkeys_get,hotkeys_stopandhotkeys_reset. A tracking session is state of a single server, soRedis::ClusterandRedis::DistributedraiseNotImplementedError, also insidepipelined/multi; call them on a single node instead. See the README "Hot key tracking (HOTKEYS)" section. (#1408) xaddnow acceptsidmp:andidmpauto:for idempotent production, and addxcfgset(Redis 8.6). (#1402)xreadgroupnow acceptsclaim:(Redis 8.4). (#1401)- Add compare-and-set and compare-and-delete support (Redis 8.4):
setacceptsifeq:,ifne:,ifdeq:andifdne:, and adddelexanddigest.Redis::XXH3.hexdigestcomputes the XXH3-64 digest of a value locally in pure Ruby, soifdeq:/ifdne:need noDIGESTround trip. Available onRedis::Distributed. See the README "Compare-and-set (CAS/CAD)" section. (#1393) - Add
xdelexandxackdel;xaddandxtrimnow acceptpolicy:(:keepref,:delrefor:acked);cluster('slot-stats', ...)replies are reshaped into[slot, Hash]pairs (Redis 8.2). (#1391, #1392) - Add the vector set commands (Redis 8.0):
vadd,vcard,vdim,vemb,vlinks,vsim,vrem,vismember,vrandmember,vrange(Redis 8.4),vinfo,vsetattrandvgetattr. All are available onRedis::Distributed. (#1382) - Add
hgetdel,hgetexandhsetex(Redis 8.0). All are available onRedis::Distributed. (#1389) - Add
hexpireat,hpexpireat,hexpiretime,hpexpiretimeandhpersist;hexpireandhpexpirenow accept thenx:/xx:/gt:/lt:condition options (Redis 7.4). All are available onRedis::Distributed. (#1374) - Add
waitaof(Redis 7.2). OnRedis::Clusterit is sent to every primary and each count in the reply is the minimum across primaries;Redis::Cluster.newnow acceptscommand_routings:to override the driver's per-command request/response policies. (#1387) - Add Redis functions (Redis 7.0):
function,fcallandfcall_ro. All are available onRedis::Distributed. (#1383) - Add
sort_ro,lcs,sintercardandzintercard(Redis 7.0). All are available onRedis::Distributed. (#1384) infonow accepts several sections at once,shutdownacceptssave:,now:,force:andabort:,xgroupacceptsentriesread:, and addxsetidwithentriesadded:andmaxdeletedid:(Redis 7.0). (#1385)- Query Engine vector fields pass every attribute through, so algorithm-specific ones such as
compression: "SQ8"andtraining_threshold:(Redis 8.12) need no special handling. (#1397) - Make the constants under
Redis, such as the reply-reshaping lambdas andRedis::Future::FutureNotReady, shareable, so that commands and pipelines work in non-main Ractors. (#1403) - Add
redis/ractorize, which freezesRedis::Client::ERROR_MAPPINGandRedis::Cluster::Client::ERROR_MAPPINGso that errors can be translated in non-main Ractors. Require it in the main Ractor after anything that adds errors to the mappings. See the README "Ractors" section. (#1403)
Bug fixes
- Make
hsetreturn0without calling the server when given an empty hash, instead of raisingERR wrong number of arguments for 'hset' command. (#1290, #1404) - Make
Redis::Distributed#multirelease the watched key once the transaction runs or raises, so that commands on keys stored on other nodes no longer raiseCannotDistributeafter awatchandmultisequence. An explicit#unwatchor another#multiafter the transaction still works as before. (#1407) - Fix a race where calling
unsubscribe/punsubscribefrom another thread while the subscribed client was concurrently tearing down raisedNoMethodErrorinstead ofRedis::SubscriptionError. (#1375) - With sentinels, errors raised by
pipelinedandmultiare now translated toRedis::*errors instead of surfacing asRedisClient::*errors. (#1396) zrankandzrevrankwithwith_score: truereturnnilfor a missing key or member instead of[nil, nil], and RESP2nanreplies becomeFloat::NAN(Redis 7.2). (#1388)xautoclaimreplies now include a'deleted'key with the ids that were deleted from the stream and dropped from the PEL (Redis 7.0; always[]on 6.2). (#1386)migrateinsidepipelined/multinow falls back to the client'sdbandtimeoutinstead of the pipeline's. (#1381)himport_preparesnapshots the field names at preparation time, so mutating the strings afterwards no longer changes the schema used for automatic re-preparation. (#1380)ft_aggregatenow sends the rightLOADfield count when the fields are given as nested arrays. (#1379)- In
pipelined(exception: false), errors are no longer passed through the reply reshaping lambdas, the flag now also applies tomultiinside the pipeline, and whenEXECaborts the transaction's command futures hold the error instead of staying unresolved. (#1377) - Only fall back to RESP2 when
HELLOitself fails withNOPROTO, instead of on any command error whose message containsNOPROTO. (#1376) Redis::HashRing#remove_nodefilters the ring positions once instead of once per replica. (#1378)
Maintenance
- Pin
redis-clientto0.31.0. (#1400) - Pin
redis-cluster-clientto0.18.0; see cluster/CHANGELOG.md for the routing changes it brings toRedis::Cluster. (#1375, #1395) - Document the
himport_auto_prepareclient option. (#1370) - Add CONTRIBUTORS.md. (#1410)
6.0.0
Breaking changes
- Use RESP3 (
HELLO 3) by default; passprotocol: 2to keep RESP2.GEOPOSandGEOSEARCH/GEORADIUSwithWITHCOORDnow return coordinates asFloatinstead ofString. See specs/migration-resp3.md. (#1351) - Require Ruby 3.2+. (#1353, #1365)
New features
- Add support for the
RedisQuery Engine (RediSearch,FT.*):ft_create,ft_alter,ft_dropindex,ft_info,ft_search,ft_aggregate, vector and hybrid search, suggestions, dictionaries, synonyms, aliases, and spellcheck. Not supported byRedis::Distributed. (#1356, #1359, #1360, #1361) - Add support for the JSON module:
json_set,json_get,json_mset,json_mget,json_del,json_forget,json_clear,json_merge,json_arr*,json_obj*,json_str*,json_numincrby,json_toggle,json_type,json_debug_memory. (#1346, #1347, #1348, #1349) - Add
lmovemandblmovem(Redis 8.10). (#1363) - Add
sunioncardandsdiffcard(Redis 8.10). (#1357) xreadandxreadgroupnow acceptmax_count:andmax_size:(Redis 8.10). (#1358)- Add
hexpire,hpexpire,httlandhpttl(Redis 7.4). (#1324, #1325, #1331) hscanandhscan_eachnow acceptnovalues: true(Redis 7.4). (#1327)- Add
geosearchandgeosearchstore(Redis 6.2); geo commands are now available onRedis::Distributed. (#1342) geoaddnow acceptsnx:,xx:andch:; geo radius searches acceptcount_any:;xaddacceptslimit:(Redis 6.2). (#1345)Redis::Distributednow implementshscan,hscan_eachandhstrlen. (#1319)- Identify the client to the server via
CLIENT SETINFO(lib-name=redis-rb,lib-ver=<version>). Extend the reported name withdriver_info:, or disable withdriver_info: false. See the README "Client identification" section. (#1369)
Experimental
- Add
himport_prepare,himport_set,himport_discardandhimport_discard_all(Redis 8.10HIMPORT). Lost fieldsets are re-prepared and retried automatically; disable withhimport_auto_prepare: false. The API may change in a future minor release. See the README "Bulk hash ingestion (HIMPORT)" section. (#1364)
Bug fixes
- Fix
FloatifyPairsto not re-transform already transformed replies. (#1354) unlinknow returns0for an empty keyset, consistent withdel. (#1316)
Maintenance
- Pin
redis-clientto the exact version0.30.1(previously>= 0.22.0); includes the reply-desynchronization fix from 0.26.4. (#1350, #1352) - Maintainership change:
redis-rbis now maintained by theRedisLtd company. - Run the test suite against prebuilt
redislabs/client-libs-testDocker images; CI now covers MRI 3.2/3.3/3.4/4.0 and TruffleRuby against Redis 7.2–8.10; JRuby removed. (#1317, #1318, #1344) - Drop the unused
executablesconfig from the gemspec. (#1322)
5.4.1
- Properly handle NOSCRIPT errors.
5.4.0
- Fix
blmpopmethod to actually useBLMPOP, it was mistakenly issuingLMPOPcommands. xaddnow accepts aminid:argument.zrankandzrevranknow acceptswith_score:argument.Redis#callnow accept a block, allowing to useRedisinstances whereRedisClientis expected.
5.3.0
- Fix the return type of
hgetallwhen used inside amultitransaction which is itself inside a pipeline.
5.2.0
- Now require Ruby 2.6 because
redis-clientdoes. - Eagerly close subscribed connection when using
subscribe_with_timeout. See #1259. - Add
exceptionflag inpipelinedallowing failed commands to be returned in the result array when set tofalse.
5.1.0
multinow accept awatchkeyword argument likeredis-client. See #1236.bitcountandbitposnow accept ascale:argument onRedis7+. See #1242- Added
expiretimeandpexpiretime. See #1248.
5.0.8
- Fix
Redis#without_reconnectfor sentinel clients. Fix #1212. - Add
sentinel_username,sentinel_passwordfor sentinel clients. Bumpredis-clientto>=0.17.0. See #1213
5.0.7
- Fix compatibility with
redis-client 0.15.0when usingRedisSentinel. Fix #1209.
5.0.6
- Wait for an extra
config.read_timeoutin blocking commands rather than an arbitrary 100ms. See #1175. - Treat ReadOnlyError as ConnectionError. See #1168.
5.0.5
- Fix automatic disconnection when the process was forked. See #1157.
5.0.4
- Cast
ttlargument to integer inexpire,setexand a few others.
5.0.3
- Add
OutOfMemoryErroras a subclass ofCommandError
5.0.2
- Fix
Redis#closeto properly reset the fork protection check.
5.0.1
- Added a fake
Redis::Connections.driversmethod to be compatible with older sidekiq versions.
5.0.0
- Default client timeout decreased from 5 seconds to 1 second.
- Eagerly and strictly cast Integer and Float parameters.
- Allow to call
subscribe,unsubscribe,psubscribeandpunsubscribefrom a subscribed client. See #1131. - Use
MD5for hashing server nodes inRedis::Distributed. This should improve keys distribution among servers. See #1089. - Changed
saddandsremto now always return an Integer. - Added
sadd?andsrem?which always return a Boolean. - Added support for
IDLEparamter inxpending. - Cluster support has been moved to a
redis-clusteringcompanion gem. selectno longer record the current database. If the client has to reconnect afterselectwas used, it will reconnect to the original database.- Better support Float timeout in blocking commands. See #977.
Redis.newwill now raise an error if provided unknown options.- Removed positional timeout in blocking commands (
BLPOP, etc). Timeout now must be passed as an option:r.blpop("key", timeout: 2.5) - Removed
loggeroption. - Removed
reconnect_delay_maxandreconnect_delay, you can pass precise sleep durations toreconnect_attemptsinstead. - Require Ruby 2.5+.
- Removed the deprecated
queueandcommitmethods. Usepipelinedinstead. - Removed the deprecated
Redis::Future#==. - Removed the deprecated
pipelinedandmultisignature. Commands now MUST be called on the block argument, not the original redis instance. - Removed
Redis.current. You shouldn't assume there is a single globalRedisconnection, use a connection pool instead, and libaries using Redis should accept a Redis instance (or connection pool) as a config. E.g.MyLibrary.redis = Redis.new(...). - Removed the
synchronydriver. - Removed
Redis.exists_returns_integer, it's now always enabled.
4.8.1
- Automatically reconnect after fork regardless of
reconnect_attempts
4.8.0
- Introduce
sadd?andsrem?as boolean returning versions ofsaddandsrem. - Deprecate
saddandsremreturning a boolean when called with a single argument. To enable the redis 5.0 behavior you can setRedis.sadd_returns_boolean = false. - Deprecate passing
timeoutas a positional argument in blocking commands (brpop,blop, etc).
4.7.1
- Gracefully handle OpenSSL 3.0 EOF Errors (
OpenSSL::SSL::SSLError: SSL_read: unexpected eof while reading). See #1106 This happens frequently on heroku-22.
4.7.0
- Support single endpoint architecture with SSL/TLS in cluster mode. See #1086.
zremandzaddact as noop when provided an empty list of keys. See #1097.- Support IPv6 URLs.
- Add
Redis#withfor better compatibility withconnection_poolusage. - Fix the block form of
multicalled insidepipelined. Previously theMUTLI/EXECwouldn't be sent. See #1073.
4.6.0
-
Deprecate
Redis.current. -
Deprecate calling commands on
RedisinsideRedis#pipelined. See #1059.redis.pipelined do redis.get("key") endshould be replaced by:
redis.pipelined do |pipeline| pipeline.get("key") end -
Deprecate calling commands on
RedisinsideRedis#multi. See #1059.redis.multi do redis.get("key") endshould be replaced by:
redis.multi do |transaction| transaction.get("key") end -
Deprecate
Redis#queueandRedis#commit. See #1059. -
Fix
zpopmaxandzpopminwhen called inside a pipeline. See #1055. -
Redis#synchronizeis now private like it should always have been. -
Add
Redis.silence_deprecations=to turn off deprecation warnings. If you don't wish to see warnings yet, you can setRedis.silence_deprecations = true. It is however heavily recommended to fix them instead when possible. -
Add
Redis.raise_deprecations=to turn deprecation warnings into errors. This makes it easier to identitify the source of deprecated APIs usage. It is recommended to setRedis.raise_deprecations = truein development and test environments. -
Add new options to ZRANGE. See #1053.
-
Add ZRANGESTORE command. See #1053.
-
Add SCAN support for
Redis::Cluster. See #1049. -
Add COPY command. See #1053. See #1048.
-
Add ZDIFFSTORE command. See #1046.
-
Add ZDIFF command. See #1044.
-
Add ZUNION command. See #1042.
-
Add HRANDFIELD command. See #1040.
4.5.1
- Restore the accidential auth behavior of redis-rb 4.3.0 with a warning. If provided with the
defaultuser's password, but a wrong username, redis-rb will first try to connect as the provided user, but then will fallback to connect as thedefaultuser with the provided password. This behavior is deprecated and will be removed in Redis 4.6.0. Fix #1038.
4.5.0
- Handle parts of the command using incompatible encodings. See #1037.
- Add GET option to SET command. See #1036.
- Add ZRANDMEMBER command. See #1035.
- Add LMOVE/BLMOVE commands. See #1034.
- Add ZMSCORE command. See #1032.
- Add LT/GT options to ZADD. See #1033.
- Add SMISMEMBER command. See #1031.
- Add EXAT/PXAT options to SET. See #1028.
- Add GETDEL/GETEX commands. See #1024.
Redis#existsnow returns an Integer by default, as warned since 4.2.0. The old behavior can be restored withRedis.exists_returns_integer = false.- Fix Redis < 6 detection during connect. See #1025.
- Fix fetching command details in
Rediscluster when the first node is unhealthy. See #1026.
4.4.0
Rediscluster: fix cross-slot validation in pipelines. Fix ##1019.- Add support for
XAUTOCLAIM. See #1018. - Properly issue
READONLYwhen reconnecting to replicas. Fix #1017. - Make
dela noop if passed an empty list of keys. See #998. - Add support for
ZINTER. See #995.
4.3.1
- Fix password authentication against redis server 5 and older.
4.3.0
- Add the TYPE argument to scan and scan_each. See #985.
- Support AUTH command for ACL. See #967.
4.2.5
- Optimize the ruby connector write buffering. See #964.
4.2.4
- Fix bytesize calculations in the ruby connector, and work on a copy of the buffer. Fix #961, #962.
4.2.3
- Use io/wait instead of IO.select in the ruby connector. See #960.
- Use exception free non blocking IOs in the ruby connector. See #926.
- Prevent corruption of the client when an interrupt happen during inside a pipeline block. See #945.
4.2.2
- Fix
WATCHsupport forRedis::Distributed. See #941. - Fix handling of empty stream responses. See #905, #929.
4.2.1
- Fix
exists?returning an actual boolean when called with multiple keys. See #918. - Setting
Redis.exists_returns_integer = falsedisables warning message about new behaviour. See #920.
4.2.0
- Convert commands to accept keyword arguments rather than option hashes. This both help catching typos, and reduce needless allocations.
- Deprecate the synchrony driver. It will be removed in 5.0 and hopefully maintained as a separate gem. See #915.
- Make
Redis#existsvariadic, will return an Integer if called with multiple keys. - Add
Redis#exists?to get a Boolean if any of the keys exists. Redis#existswhen called with a single key will warn that future versions will return an Integer. SetRedis.exists_returns_integer = trueto opt-in to the new behavior.- Support
keepttlooption inset. See #913. - Optimized initialization of Redis::Cluster. See #912.
- Accept sentinel options even with string key. See #599.
- Verify TLS connections by default. See #900.
- Make
Redis#hsetvariadic. It now returns an integer, not a boolean. See #910.
4.1.4
- Alias
Redis#disconnectas#close. See #901. - Handle clusters with multiple slot ranges. See #894.
- Fix password authentication to a redis cluster. See #889.
- Handle recursive MOVED responses. See #882.
- Increase buffer size in the ruby connector. See #880.
- Fix thread safety of
Redis.queue. See #878. - Deprecate
Redis::Future#==as it's likely to be a mistake. See #876. - Support
KEEPTTLoption for SET command. See #913.
4.1.3
- Fix the client hanging forever when connecting with SSL to a non-SSL server. See #835.
4.1.2
- Fix several authentication problems with sentinel. See #850 and #856.
- Explicitly drop Ruby 2.2 support.
4.1.1
- Fix error handling in multi blocks. See #754.
- Fix geoadd to accept arrays like georadius and georadiusbymember. See #841.
- Fix georadius command failing when long == lat. See #841.
- Fix timeout error in xread block: 0. See #837.
- Fix incompatibility issue with redis-objects. See #834.
- Properly handle Errno::EADDRNOTAVAIL on connect.
- Fix password authentication to sentinel instances. See #813.
4.1.0
- Add Redis Cluster support. See #716.
- Add streams support. See #799 and #811.
- Add ZPOP* support. See #812.
- Fix issues with integer-like objects as BPOP timeout
4.0.3
- Fix raising command error for first command in pipeline. See #788.
- Fix the gemspec to stop exposing a
buildexecutable. See #785. - Add
:reconnect_delayand:reconnect_delay_maxoptions. See #778.
4.0.2
-
Added
Redis#unlink. See #766. -
Redis.newnow accept a custom connector via:connector. See #591. -
Redis#multino longer perform empty transactions. See #747. -
Redis#hdelnow accepts hash keys as multiple arguments like#del. See #755. -
Allow to skip SSL verification. See #745.
-
Add Geo commands:
geoadd,geohash,georadius,georadiusbymember,geopos,geodist. See #730.
4.0.1
-
Redis::Distributednow supportsmgetandmapped_mget. See #687. -
Redis::Distributednow supportssscanandsscan_each. See #572. -
Redis#connectionreturns a hash with connection information. You shouldn't need to callRedis#_client, ever. -
Redis#flushdbandRedis#flushallnow support the:asyncoption. See #706.
4.0
-
Removed
Redis.connect. UseRedis.new. -
Removed
Redis#[]andRedis#[]=aliases. -
Added support for
CLIENTcommands. The lower-level client can be accessed viaRedis#_client. -
Dropped official support for Ruby < 2.2.2.
3.3.5
- Fixed Ruby 1.8 compatibility after backporting
Redis#connection. See #719.
3.3.4 (yanked)
Redis#connectionreturns a hash with connection information. You shouldn't need to callRedis#_client, ever.
3.3.3
- Improved timeout handling after dropping Timeout module.
3.3.2
-
Added support for
SPOPwith COUNT. See #628. -
Fixed connection glitches when using SSL. See #644.
3.3.1
- Remove usage of Timeout::timeout, refactor into using low level non-blocking writes. This fixes a memory leak due to Timeout creating threads on each invocation.
3.3.0
-
Added support for SSL/TLS.
Redisdoesn't support SSL natively, so you still need to run a terminating proxy on Redis' side. See #496. -
Added
read_timeoutandwrite_timeoutoptions. See #437, #482. -
Added support for pub/sub with timeouts. See #329.
-
Added
Redis#call,Redis#queueandRedis#commitas a more minimal API to the client. -
Deprecated
Redis#disconnect!in favor ofRedis#close.
3.2.2
-
Added support for
ZADDoptionsNX,XX,CH,INCR. See #547. -
Added support for sentinel commands. See #556.
-
New
:idoption allows you to identify the client againstRedis. See #510. -
Redis::Distributedwill raise when adding two nodes with the same ID. See #354.
3.2.1
-
Added support for
PUBSUBcommand. -
More low-level socket errors are now raised as
CannotConnectError. -
Added
:connect_timeoutoption. -
Added support for
:limitoption forZREVRANGEBYLEX. -
Fixed an issue where connections become inconsistent when using Ruby's Timeout module outside of the client (see #501, #502).
-
Added
Redis#disconnect!as a public-API way of disconnecting the client (without needing to useQUIT). See #506. -
Fixed Sentinel support with Hiredis.
-
Fixed Sentinel support when using authentication and databases.
-
Improved resilience when trying to contact sentinels.
3.2.0
RedisSentinel support.
3.1.0
-
Added debug log sanitization (#428).
-
Added support for HyperLogLog commands (Redis 2.8.9, #432).
-
Added support for
BITPOScommand (Redis 2.9.11, #412). -
The client will now automatically reconnect after a fork (#414).
-
If you want to disable the fork-safety check and prefer to share the connection across child processes, you can now pass the
inherit_socketoption (#409). -
If you want the client to attempt to reconnect more than once, you can now pass the
reconnect_attemptsoption (#347)
3.0.7
-
Added method
Redis#dupto duplicate aRedisconnection. -
IPv6 support.
3.0.6
- Added support for
SCANand variants.
3.0.5
-
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).
3.0.4
-
Ensure #watch without a block returns "OK" (#332).
-
Make futures identifiable (#330).
-
Fix an issue preventing STORE in a SORT with multiple GETs (#328).
3.0.3
-
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
DUMPandRESTORE(Redis 2.6). -
Added support for
BITCOUNTandBITOP(Redis 2.6). -
Call
#to_son value argument forSET,SETEX,PSETEX,GETSET,SETNX, andSETRANGE.
3.0.2
-
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
EXECreturns an error. -
Passing a nil value in options hash no longer overwrites the default.
-
Allow string keys in options hash passed to
Redis.neworRedis.connect. -
Fix uncaught error triggering unrelated error (synchrony driver).
See f7ffd5f1a628029691084de69e5b46699bb8b96d and #248.
3.0.1
-
Fix reconnect logic not kicking in on a write error.
See 427dbd52928af452f35aa0a57b621bee56cdcb18 and #238.
3.0.0
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
#pipelinedand#multino 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
RuntimeErrorand errors in theErrnofamily.
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 specify `KEYS` and `ARGV`, or take a hash containing `:keys` and `:argv` to specify `KEYS` and `ARGV`. ```ruby 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: ```ruby 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,HINCRYBYFLOATandTIME(Redis 2.6). -
Redis.currentis now thread unsafe, because the client itself is thread safe.In the future you'll be able to do something like: ```ruby 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,BRPOPandBRPOPLPUSH.Both `BLPOP` and `BRPOP` 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 to `0` to not time out. ```ruby 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 to `0` to not time out. ```ruby redis.brpoplpush("some_list", "another_list", :timeout => 1.0) ``` -
When
SORTis passed multiple key patterns to get via the:getoption, it now returns an array per result element, holding allGETsubstitutions. -
The
MSETNXcommand now returns a boolean. -
The
ZRANGE,ZREVRANGE,ZRANGEBYSCOREandZREVRANGEBYSCOREcommands now return an array containing[String, Float]pairs when:with_scores => trueis passed.For example: ```ruby redis.zrange("zset", 0, -1, :with_scores => true) # => [["foo", 1.0], ["bar", 2.0]] ``` -
The
ZINCRBYandZSCOREcommands now return aFloatscore 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.
```ruby $redis.pipelined do @future = $redis.get "key" end puts @future.value ``` -
Ruby 1.8.6 is officially not supported.
-
Support
ZCOUNTinRedis::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
SLOWLOGcommand (Michael Bernstein). -
Calling
SHUTDOWNeffectively 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
Redis2.4.
2.2.2
- Added method
Redis::Distributed#hsetnx.
2.2.1
-
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
INFOcommand can optionally take a subcommand. When the subcommand isCOMMANDSTATS, the client will properly format the returned statistics per command. Subcommands forINFOare available since Redis v2.3.0 (unstable). -
Change
IO#syswriteback to the bufferedIO#writesince some Rubies do short writes for large (1MB+) buffers and some don't (see issue #108).
2.2.0
-
Added method
Redis#without_reconnectthat ensures the client will not try to reconnect when running the code inside the specified block. -
Thread-safe by default. Thread safety can be explicitly disabled by passing
:thread_safe => falseas argument. -
Commands called inside a MULTI/EXEC no longer raise error replies, since a successful EXEC means the commands inside the block were executed.
-
MULTI/EXEC blocks are pipelined.
-
Don't disconnect on error replies.
-
Use
IO#syswriteinstead ofIO#writebecause write buffering is not necessary. -
Connect to a unix socket by passing the
:pathoption as argument. -
The timeout value is coerced into a float, allowing sub-second timeouts.
-
Accept both
:with_scoresand:withscoresas argument to sorted set commands. -
Use hiredis (v0.3 or higher) by requiring "redis/connection/hiredis".
-
Use em-synchrony by requiring "redis/connection/synchrony".
2.1.1
See commit log.