mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
Improves flat_tree implementation (#358)
* Makes flat_tree implementation use a custom buffer. This allows: * Never dangling nodes (previously, node values could dangle after calling reserve() or if notify_done() wasn't called). * Reduced memory consumption * Increased runtime speed * Changes flat_tree assignment to the usual signature and semantics * Fixes a bug causing an assertion to trigger when copy-constructing an empty flat_tree. * Changes basic_node operator== and operator!= return type * Adds generic_flat_response, basic_tree, tree, view_tree, flat_tree to the reference page. * Adds a missing resp3:: qualifier to all names in the reference page that belong to the resp3 namespace. * Adds reference documentation to flat_tree. * Mentions generic_flat_response in the discussion. * Adds operator!= for basic_node to basic_node's reference page. * Adds test_flat_tree. close #357 close #354 close #352
This commit is contained in:
committed by
GitHub
parent
91afb4a279
commit
d9e4b2c720
@@ -55,6 +55,8 @@ xref:reference:boost/redis/response.adoc[`response`]
|
||||
|
||||
xref:reference:boost/redis/generic_response.adoc[`generic_response`]
|
||||
|
||||
xref:reference:boost/redis/generic_flat_response.adoc[`generic_flat_response`]
|
||||
|
||||
xref:reference:boost/redis/consume_one-08.adoc[`consume_one`]
|
||||
|
||||
|
||||
@@ -70,25 +72,33 @@ xref:reference:boost/redis/adapter/result.adoc[`adapter::result`]
|
||||
xref:reference:boost/redis/any_adapter.adoc[`any_adapter`]
|
||||
|
||||
|
|
||||
xref:reference:boost/redis/resp3/basic_node.adoc[`basic_node`]
|
||||
xref:reference:boost/redis/resp3/basic_node.adoc[`resp3::basic_node`]
|
||||
|
||||
xref:reference:boost/redis/resp3/node.adoc[`node`]
|
||||
xref:reference:boost/redis/resp3/node.adoc[`resp3::node`]
|
||||
|
||||
xref:reference:boost/redis/resp3/node_view.adoc[`node_view`]
|
||||
xref:reference:boost/redis/resp3/node_view.adoc[`resp3::node_view`]
|
||||
|
||||
xref:reference:boost/redis/resp3/basic_tree.adoc[`resp3::basic_tree`]
|
||||
|
||||
xref:reference:boost/redis/resp3/tree.adoc[`resp3::tree`]
|
||||
|
||||
xref:reference:boost/redis/resp3/view_tree.adoc[`resp3::view_tree`]
|
||||
|
||||
xref:reference:boost/redis/resp3/flat_tree.adoc[`resp3::flat_tree`]
|
||||
|
||||
xref:reference:boost/redis/resp3/boost_redis_to_bulk-08.adoc[`boost_redis_to_bulk`]
|
||||
|
||||
xref:reference:boost/redis/resp3/type.adoc[`type`]
|
||||
xref:reference:boost/redis/resp3/type.adoc[`resp3::type`]
|
||||
|
||||
xref:reference:boost/redis/resp3/is_aggregate.adoc[`is_aggregate`]
|
||||
xref:reference:boost/redis/resp3/is_aggregate.adoc[`resp3::is_aggregate`]
|
||||
|
||||
|
||||
|
|
||||
|
||||
xref:reference:boost/redis/adapter/adapt2.adoc[`adapter::adapt2`]
|
||||
|
||||
xref:reference:boost/redis/resp3/parser.adoc[`parser`]
|
||||
xref:reference:boost/redis/resp3/parser.adoc[`resp3::parser`]
|
||||
|
||||
xref:reference:boost/redis/resp3/parse.adoc[`parse`]
|
||||
xref:reference:boost/redis/resp3/parse.adoc[`resp3::parse`]
|
||||
|
||||
|===
|
||||
@@ -278,7 +278,8 @@ struct basic_node {
|
||||
----
|
||||
|
||||
Any response to a Redis command can be parsed into a
|
||||
xref:reference:boost/redis/generic_response.adoc[boost::redis::generic_response].
|
||||
xref:reference:boost/redis/generic_response.adoc[boost::redis::generic_response]
|
||||
and its counterpart xref:reference:boost/redis/generic_flat_response.adoc[boost::redis::generic_flat_response].
|
||||
The vector can be seen as a pre-order view of the response tree.
|
||||
Using it is not different than using other types:
|
||||
|
||||
@@ -292,7 +293,7 @@ co_await conn->async_exec(req, resp);
|
||||
For example, suppose we want to retrieve a hash data structure
|
||||
from Redis with `HGETALL`, some of the options are
|
||||
|
||||
* `boost::redis::generic_response`: always works.
|
||||
* `boost::redis::generic_response` and `boost::redis::generic_flat_response`: always works.
|
||||
* `std::vector<std::string>`: efficient and flat, all elements as string.
|
||||
* `std::map<std::string, std::string>`: efficient if you need the data as a `std::map`.
|
||||
* `std::map<U, V>`: efficient if you are storing serialized data. Avoids temporaries and requires `boost_redis_from_bulk` for `U` and `V`.
|
||||
|
||||
Reference in New Issue
Block a user