Changelog from v4.0.0 and up. v3 changelog can be found in its branch.
-
Fixed
Sentinel
not creating connections to new secondaries properly. (#336) -
Complete refactor of
Conn
, code is simpler and a few cases whereConn
was getting out of sync with its writes/reads are now handled properly. -
Fixed calls to
Unsubscribe
andPSubscribe
not correctly clearing all subscriptions. (#318) -
Fixed the subscriptions made with
PSubscribe
not working correctly. (#333)
-
Fixed
NewCluster
not returning an error if it can't connect to any of the redis instances given. (#319) -
Fix parsing for
CLUSTER SLOTS
command, which changed slightly with redis 7.0. (#320) -
Fix a bug around discarding of errors in
Conn
. (#323) -
Properly handle the
MEMORY USAGE
command in the context of a cluster. (#325)
New
- Added
TreatErrorsAsValues
field toresp.Opts
. (#309)
Fixes and Improvements
- Fixed PubSubMessage unmarshaling not correctly handling non-pubsub messages. (#306)
Below is documented all breaking changes between v3 and v4. There are further enhancements which don't qualify as breaking changes which may not be documented here.
Major Changes
-
Stop using
...opts
pattern for optional parameters across all types, and switch instead to a(Config{}).New
kind of pattern. -
Add
MultiClient
interface which is implemented bySentinel
andCluster
,Client
has been modified to be implemented only by clients which point at a single redis instance (Conn
andPool
). Methods on all affected client types have been modified to fit these new interfaces.Cluster.NewScanner
has been replaced byScannerConfig.NewMulti
.
-
Conn
has been completely re-designed. It is now always thread-safe. When multipleAction
s are performed against a singleConn
concurrently theConn
will automatically pipeline theAction
's read/writes, as appropriate.-
Pipeline
has been re-designed as a result as well. -
CmdAction
has been removed.
-
-
Pool
has been completely rewritten to better take advantage of connection sharing (previously called "implicit pipelining" in v3) and the newConn
design.-
EvalScript
andPipeline
now support connection sharing. -
Since most
Action
s can be shared on the sameConn
thePool
no longer runs the risk of being depleted during too many concurrentAction
s, and so no longer needs to dynamically create/destroyConn
s. -
A Pool size of 0 is no longer supported.
-
-
Brand new
resp/resp3
package which implements the RESP3 protocol. The new package features more consistent type mappings between go and redis and support for streaming types. -
Usage of
context.Context
in many places.-
Add
context.Context
parameter toClient.Do
,PubSub
methods,Scanner.Next
, andWithConn
. -
Add
context.Context
parameter to allClient
andConn
creation functions. -
Add
context.Context
parameter toAction.Perform
(previously calledAction.Run
).
-
-
The
PubSubConn
interface has been redesigned to be simpler to implement and use. Naming around pub/sub types has also been made more consistent.
Minor Changes
-
Remove usage of
xerrors
package. -
Rename
resp.ErrDiscarded
toresp.ErrConnUsable
, and change some of the semantics around using the error. Aresp.ErrConnUnusable
convenience function has been added as well. -
resp.LenReader
now usesint
instead ofint64
to signify length. -
resp.Marshaler
andresp.Unmarshaler
now take anOpts
argument, to give the caller more control over things like byte pools and potentially other functionality in the future. -
resp.Unmarshaler
now takes aresp.BufferedReader
, rather than*bufio.Reader
. Generallyresp.BufferedReader
will be implemented by a*bufio.Reader
, but this gives more flexibility. -
Stub
andPubSubStub
have been renamed toNewStubConn
andNewPubSubStubConn
, respectively. -
Rename
MaybeNil
to justMaybe
, and change its semantics a bit. -
The
trace
package has been significantly updated to reflect changes toPool
and otherClient
s. -
Refactor the
StreamReader
interface to be simpler to use.