You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-33Lines changed: 36 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,24 +46,46 @@ The execution of `connection::async_exec` above is composed with
46
46
that ensures that one operation is cancelled as soon as the other
47
47
completes, these functions play the following roles
48
48
49
-
*`connection::async_exec`: Execute commands by writing the request payload to the underlying stream and reading the response sent back by Redis. It can be called from multiple places in your code concurrently.
50
-
*`connection::async_run`: Coordinate the low-level IO (read and write) operations. It remains suspended until the connection is lost.
51
-
52
-
The `async_exec` calls won't automatically fail when the connection is
53
-
lost, instead, they will remain suspended until either
54
-
`connection::cancel(operation::exec)` is called to cancel them all or
55
-
a new connection is established and `async_run` is called again.
56
-
Users can customise the desired behaviour by carefully choosing
57
-
`aedis::resp3::request::config`. The role played by `async_run`
58
-
becomes clearer with long-lived connections, which we will cover in
59
-
the next section.
49
+
*`connection::async_exec`: Execute commands by queuing the request
50
+
for writing and wait for the response sent back by Redis. It can be
51
+
called from multiple places in your code concurrently.
52
+
*`connection::async_run`: Coordinate low-level read and write
53
+
operations. More specifically, it will hand IO control to
54
+
`async_exec` when a response arrives and to
55
+
`aedis::connection::async_receive` when a server-push is received.
56
+
It will also trigger writes of pending requests when a reconnection
57
+
occurs. It remains suspended until the connection is lost.
58
+
59
+
By carefully choosing the flags `aedis::resp3::request::config` users
60
+
can also express their desire to not automatically cancel pending
61
+
requests when the connection is lost, giving the opportunity to
62
+
reconnect and call `async_run` again after a failover to trigger their
63
+
execution, perhaps in another Redis instance. Before we approach
64
+
long-lived connections in the next section users will find it helpful
65
+
to skim over the examples
66
+
67
+
* intro.cpp: The Aedis hello-world program. Sends one command and quits the connection.
68
+
* intro_tls.cpp: Same as intro.cpp but over TLS.
69
+
* intro_sync.cpp: Shows how to use the connection class synchronously.
70
+
* containers.cpp: Shows how to send and receive STL containers and how to use transactions.
71
+
* serialization.cpp: Shows how to serialize types using Boost.Json.
72
+
* resolve_with_sentinel.cpp: Shows how to resolve a master address using sentinels.
73
+
* subscriber.cpp: Shows how to implement pubsub with reconnection re-subscription.
74
+
* echo_server.cpp: A simple TCP echo server.
75
+
* chat_room.cpp: A command line chat built on Redis pubsub.
76
+
* low_level_sync.cpp: Sends a ping synchronously using the low-level API.
77
+
* low_level_async.cpp: Sends a ping asynchronously using the low-level API.
78
+
79
+
To avoid repetition code that is common to some examples has been
80
+
grouped in common.hpp. The main function used in some async examples
81
+
has been factored out in the main.cpp file.
60
82
61
83
<aname="connection"></a>
62
84
## Connection
63
85
64
86
For performance reasons we will usually want to perform multiple
65
87
requests on the same connection. We can do this with the example above
66
-
by decoupling the HELLO command and the call to `async_run` in a
88
+
by decoupling the `HELLO` command and the call to `async_run` in a
67
89
separate coroutine
68
90
69
91
```cpp
@@ -561,26 +583,6 @@ In addition to the above users can also use unordered versions of the
561
583
containers. The same reasoning also applies to sets e.g. `SMEMBERS`
562
584
and other data structures in general.
563
585
564
-
## Examples
565
-
566
-
These examples demonstrate what has been discussed so far.
567
-
568
-
* intro.cpp: The Aedis hello-world program. Sends one command and quits the connection.
569
-
* intro_tls.cpp: Same as intro.cpp but over TLS.
570
-
* intro_sync.cpp: Shows how to use the connection class synchronously.
571
-
* containers.cpp: Shows how to send and receive STL containers and how to use transactions.
572
-
* serialization.cpp: Shows how to serialize types using Boost.Json.
573
-
* resolve_with_sentinel.cpp: Shows how to resolve a master address using sentinels.
574
-
* subscriber.cpp: Shows how to implement pubsub with reconnection re-subscription.
575
-
* echo_server.cpp: A simple TCP echo server.
576
-
* chat_room.cpp: A command line chat built on Redis pubsub.
577
-
* low_level_sync.cpp: Sends a ping synchronously using the low-level API.
578
-
* low_level_async.cpp: Sends a ping asynchronously using the low-level API.
579
-
580
-
To avoid repetition code that is common to all examples has been
581
-
grouped in common.hpp. The main function used in some async examples
582
-
has been factored out in the main.cpp file.
583
-
584
586
## Echo server benchmark
585
587
586
588
This document benchmarks the performance of TCP echo servers I
@@ -829,8 +831,9 @@ Acknowledgement to people that helped shape Aedis
829
831
830
832
## Changelog
831
833
832
-
### v1.4.0
834
+
### v1.4.0-1
833
835
836
+
* Renames `retry_on_connection_lost` to `cancel_if_unresponded`. (v1.4.1)
834
837
* Removes dependency on Boost.Hana, boost::string_view, Boost.Variant2 and Boost.Spirit.
0 commit comments