RediStack 2.0.0 Alpha 1
Pre-releaseAPI Docs are always available at docs.redistack.info
RedisCommand
has been repurposed from the RedisCommandHandler.OutboundIn
type to now a generic general-purpose value representation of a given command keyword, it's argument payload, and its expected deserialized result type.
These changes are primarily driven by the desire to support MULTI
commands, as outlined in #88.
In RediStack 1.x, commands were inseparable from the method extension that generated them, and they were all eagerly executed in both sending and receiving.
By turning them into a lightweight value representation, a command can be delayed in being sent or its response in being deserialized.
As such, the following notable changes have happened:
RedisClient.send
now accepts just a singleRedisCommand
instance, but otherwise behaves as before: it will deserialize the response to theRedisCommand.ResultType
for youRedisCommandHandler.OutboundIn
is now a tuple of(RESPValue, EventLoopPromise<RESPValue>)
with the first element being the fully serialized command to be sent.- All command extension methods on
RedisClient
are now static factory methods onRedisCommand
- The name of the static factory extension will match the name as used by Redis itself
- In some cases, the previous extension methods on
RedisClient
still exist, but are just convenience methods for calling the appropriateRedisCommand
factory method.-
There is no established rule on when these extensions will be supported. The ones that remain are ones that tend to make sense from an English prose perspective of relationship of the action being invoked and the client
For example
RedisClient.publish(_:to:)
still exists, becauseRedisClient.publish(message, to: channel)
reads a little better thanRedisClient.send(.publish(message, to: channel))
, since the client itself is doing the publishing and there is an implicit relationship between clients and PubSub channels.As a counter-example,
RedisClient.linsert(_:into:before:)
is now only available asRedisClient.send(.linsert(_:into:before:))
because it's a general command with no clear relationship between the command being invoked and the specific client doing the invocation.
-
Major
- Swift 5.2 is now the minimum supported Swift version (b148491)
RedisCommand
and the extension methods onRedisClient
have seen a significant refactor with no deprecation support to be provided !144- As a consequence of the changes,
RedisComandHandler.OutboundIn
is now(RESPValue, EventLoopPromise<RESPValue>)
- As a consequence of the changes,
Minor
Several pieces of API have been deprecated. They will be removed in the next major version.
RedisLifetimeKey
has been moved and renamed toRedisKey.Lifetime
!143RedisLifetimeKey.Lifetime
has been renamed toRedisKey.Lifetime.Duration
!143RedisCommand.flushall
extension has been added !144