Boost.Redis: Reference

Boost.Redis 1.84.0 A redis client library

Loading...
Searching...
No Matches
Functions
Reference

## Functions
template<class T >
auto | boost::redis::adapter::adapt2 (T &t=redis::ignore) noexcept
| Adapts user data to read operations.
template<class AsyncWriteStream , class CompletionToken = asio::default_completion_token_t<typename AsyncWriteStream::executor_type>>
auto | boost::redis::detail::async_write (AsyncWriteStream &stream, request const &req, CompletionToken &&token=asio::default_completion_token_t< typename AsyncWriteStream::executor_type >{})
| Writes a request asynchronously.
template<class SyncWriteStream >
auto | boost::redis::detail::write (SyncWriteStream &stream, request const &req)
| Writes a request synchronously.

## Detailed Description

This page contains the documentation of the Aedis low-level API.

## Function Documentation

## ◆ adapt2()

template<class T >

auto boost::redis::adapter::adapt2 | ( | T & | t = redis::ignore | ) |
| noexcept

Adapts user data to read operations.

STL containers, `resp3::response` and built-in types are supported and can be used in conjunction with `std::optional<T>`.

Example usage:

std::unordered_map<std::string, std::string> cont;
co_await async_read(socket, buffer, adapt(cont));

For a transaction

sr.push(command::multi);
sr.push(command::ping, ...);
sr.push(command::incr, ...);
sr.push_range(command::rpush, ...);
sr.push(command::lrange, ...);
sr.push(command::incr, ...);
sr.push(command::exec);
co_await async_write(socket, buffer(request));
// Reads the response to a transaction
resp3::response<std::string, int, int, std::vector<std::string>, int> execs;
co_await resp3::async_read(socket, dynamic_buffer(buffer), adapt(execs));
boost::redis::request
Creates Redis requests.
Definition request.hpp:46

Definition at line 75 of file adapt.hpp.

## ◆ async_write()

template<class AsyncWriteStream , class CompletionToken = asio::default_completion_token_t<typename AsyncWriteStream::executor_type>>

auto boost::redis::detail::async_write | ( | AsyncWriteStream & | stream,
|  | request const & | req,
|  | CompletionToken && | token = asio::default_completion_token_t<typename AsyncWriteStream::executor_type>{} )

Writes a request asynchronously.

Parameters

  stream | Stream to write the request to.
  req | Request to write.
  token | Asio completion token.

Definition at line 44 of file write.hpp.

## ◆ write()

template<class SyncWriteStream >

auto boost::redis::detail::write | ( | SyncWriteStream & | stream,
|  | request const & | req )

Writes a request synchronously.

Parameters

  stream | Stream to write the request to.
  req | Request to write.

Definition at line 22 of file write.hpp.