userver: storages::redis::Match Class Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
storages::redis::Match Class Referencefinal

#include <userver/storages/redis/command_options.hpp>

Detailed Description

A command option to use in Scan, Hscan, Scan and Zscan commands.

Sample usage:

constexpr std::size_t kKeysWithSamePrefix = 100;
for (std::size_t i = 0; i < kKeysWithSamePrefix; ++i) {
redis_client->Set("the_key_" + std::to_string(i), "the_value", {}).Get();
redis_client->Set("a_key_" + std::to_string(i), "a_value", {}).Get();
}
std::size_t matches_found = 0;
for (const std::string& field : redis_client->Scan(0, storages::redis::Match{"the_key*"}, {})) {
EXPECT_EQ(field.find("the_key"), 0) << "Does not start with 'the_key'";
++matches_found;
}
EXPECT_EQ(matches_found, kKeysWithSamePrefix);

Definition at line 112 of file command_options.hpp.

Public Member Functions

 Match (std::string value)
 
const std::string & Get () const &
 
std::string Get () &&
 

Constructor & Destructor Documentation

◆ Match()

storages::redis::Match::Match ( std::string  value)
inlineexplicit

Definition at line 114 of file command_options.hpp.

Member Function Documentation

◆ Get() [1/2]

std::string storages::redis::Match::Get ( ) &&
inline

Definition at line 118 of file command_options.hpp.

◆ Get() [2/2]

const std::string & storages::redis::Match::Get ( ) const &
inline

Definition at line 116 of file command_options.hpp.


The documentation for this class was generated from the following file: