@@ -26,6 +26,12 @@ or it can be used as a relay to implement a chat server using its builtin
2626[ PubSub] ( https://redis.io/topics/pubsub )
2727features.
2828
29+ This Swift package includes the RESP protocol implementation and a simple
30+ Redis client.
31+ We also provide an actual [ Redis Server] ( https://github.com/NozeIO/redi-s )
32+ written in Swift, using SwiftNIO and SwiftNIO Redis.
33+
34+
2935## Performance
3036
3137This implementation is focused on performance.
@@ -62,7 +68,7 @@ let package = Package(
6268
6369## Using the SwiftNIO Redis protocol handler
6470
65- The RESP protocol handler just implemented as a regular
71+ The RESP protocol is implemented as a regular
6672` ChannelHandler ` , similar to ` NIOHTTP1 ` .
6773It takes incoming ` ByteBuffer ` data, parses that, and emits ` RESPValue `
6874items.
@@ -76,10 +82,12 @@ To add the RESP handler to a NIO Channel pipeline, the `configureRedisPipeline`
7682method is called, e.g.:
7783
7884``` swift
85+ import NIORedis
86+
7987bootstrap.channelInitializer { channel in
80- channel.pipeline
81- .configureRedisPipeline ()
82- .then { ... }
88+ channel.pipeline
89+ .configureRedisPipeline ()
90+ .then { ... }
8391}
8492```
8593
@@ -116,16 +124,16 @@ Using NIO Promises:
116124
117125``` swift
118126client
119- .set (" counter" , 0 , expire : 2 )
120- .then {
121- client.incr (" counter" , by : 10 )
122- }
123- .then {
124- client.get (" counter" )
125- }
126- .map {
127- print (" counter is:" , $0 )
128- }
127+ .set (" counter" , 0 , expire : 2 )
128+ .then {
129+ client.incr (" counter" , by : 10 )
130+ }
131+ .then {
132+ client.get (" counter" )
133+ }
134+ .map {
135+ print (" counter is:" , $0 )
136+ }
129137```
130138
131139
0 commit comments