Serializing and parsing into custom types
Boost.Redis supports serialization of user defined types by means of the following customization points
// Serialize
void boost_redis_to_bulk(std::string& to, mystruct const& obj);
// Deserialize
void boost_redis_from_bulk(mystruct& u, node_view const& node, boost::system::error_code&);
These functions are accessed over ADL and therefore they must be imported in the global namespace by the user. The following examples might be of interest:
-
cpp20_json.cpp: serializes and parses JSON objects.
-
cpp20_protobuf.cpp: serializes and parses protobuf objects.