boost::redis::request::push_range

Appends a new command to the end of the request.

Synopsis

Declared in <boost/redis/request.hpp>

template<class Range>
void
push_range(
    std::string_view cmd,
    std::string_view key,
    Range const& range,
    decltype(std::begin(range))* = nullptr);

Description

Equivalent to the overload taking a range of begin and end iterators.

If the passed range is empty, no command is added and this function becomes a no‐op.

The value type of the passed range should satisfy one of the following:

  • The type is convertible to `std::string_view`. One argument is added per element in the range.

  • The type is an integral type. One argument is added per element in the range.

  • The type supports the `boost_redis_to_bulk` function. One argument is added per element in the range. This function is a customization point that must be made available using ADL and must have the signature `void boost_redis_to_bulk(std::string& to, T const& t);`.

  • The type is a `std::pair` instantiation, with both arguments supporting one of the points above. Two arguments are added per element in the range. Nested pairs are not allowed.

  • The type is a `std::tuple` instantiation, with every argument supporting one of the points above. N arguments are added per element in the range, with N being the tuple size. Nested tuples are not allowed.

Template Parameters

Name Description

Range

A type that can be passed to std::begin() and std::end() to obtain iterators.

Parameters

Name Description

cmd

The command to execute. It should be a redis or sentinel command, like "SET".

key

The command key. It will be added as the first argument to the command.

range

Range containing the command arguments.

Created with MrDocs