Update 1.3.0.md

This commit is contained in:
Leonid Stryzhevskyi 2021-08-04 01:38:44 +03:00 committed by GitHub
parent d9824421a0
commit 0347820d44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,12 +54,32 @@ Now it's much easier to use `oatpp::String` since `oatpp::String` is now wrapper
[#408](https://github.com/oatpp/oatpp/issues/408)
```cpp
auto connectionPool = std::make_shared<ClientConnectionPool>(
connectionProvider /* connection provider */,
10 /* max connections */,
std::chrono::seconds(5) /* max lifetime of idle connection */
std::chrono::seconds(10) /* optional timeout to get available connection from the pool */
);
{
auto connectionProvider = oatpp::network::tcp::client::ConnectionProvider::createShared({"httpbin.org", 80});
auto pool = oatpp::network::ClientConnectionPool::createShared(connectionProvider,
1,
std::chrono::seconds(10),
std::chrono::seconds(5));
OATPP_LOGD("TEST", "start")
auto c1 = pool->get(); //<--- this one will succeed
OATPP_LOGD("TEST", "c1=%llu", c1.get())
auto c2 = pool->get(); //<--- this one will fail in 5 sec. Since Max-Resources is 1, Pool timeout is 5 sec. And c1 is not freed.
OATPP_LOGD("TEST", "c2=%llu", c2.get())
}
```
Output:
```
D |2021-08-04 01:32:56 1628029976986744| TEST:start
D |2021-08-04 01:32:57 1628029977126940| TEST:c1=140716915331208
D |2021-08-04 01:33:02 1628029982128324| TEST:c2=0
```
## JSON Serializer Escape Flags