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.sendnow accepts just a singleRedisCommandinstance, but otherwise behaves as before: it will deserialize the response to theRedisCommand.ResultTypefor youRedisCommandHandler.OutboundInis now a tuple of(RESPValue, EventLoopPromise<RESPValue>)with the first element being the fully serialized command to be sent.- All command extension methods on
RedisClientare 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
RedisClientstill exist, but are just convenience methods for calling the appropriateRedisCommandfactory 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)
RedisCommandand the extension methods onRedisClienthave seen a significant refactor with no deprecation support to be provided !144- As a consequence of the changes,
RedisComandHandler.OutboundInis 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.
RedisLifetimeKeyhas been moved and renamed toRedisKey.Lifetime!143RedisLifetimeKey.Lifetimehas been renamed toRedisKey.Lifetime.Duration!143RedisCommand.flushallextension has been added !144