Reference

boost::redis::request::push

Appends a new command to the end of the request.

Synopsis

Declared in <boost/redis/request.hpp>

template<class... Ts>
void
push(
    std::string_view cmd,
    Ts const&... args);

Description

For example:

request req;
req.push("SET", "key", "some string", "EX", "2");

This will add a SET command with value "some string" and an expiration of 2 seconds.

Command arguments should either be convertible to std::string_view or support the boost_redis_to_bulk function. This function is a customization point that must be made available using ADL and must have the following signature:

void boost_redis_to_bulk(std::string& to, T const& t);

See cpp20_serialization.cpp

Template Parameters

Name

Description

Ts

Types of the command arguments.

Parameters

Name

Description

cmd

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

args

Command arguments. Non‐string types will be converted to string by calling boost_redis_to_bulk on each argument.

Created with MrDocs