userver: storages::redis::ExecCondition Class Reference
Loading...
Searching...
No Matches
storages::redis::ExecCondition Class Reference

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

Detailed Description

A key condition for optimistic transaction execution with Valkey 9.2 or newer.

Definition at line 27 of file command_options.hpp.

Public Types

enum class  Type {
  kIfEq ,
  kIfNe ,
  kNx ,
  kXx
}
 The comparison performed before executing the queued commands. More...

Public Member Functions

Type GetType () const
 Returns the comparison to perform.
const std::string & GetKey () const
 Returns the key to check.
const std::string & GetValue () const
 Returns the comparison value for IfEq and IfNe, or an empty string for Nx and Xx.

Static Public Member Functions

static ExecCondition IfEq (std::string key, std::string value)
 Creates a string equality condition; see Type::kIfEq.
static ExecCondition IfNe (std::string key, std::string value)
 Creates a string inequality condition; see Type::kIfNe.
static ExecCondition Nx (std::string key)
 Creates a key absence condition; see Type::kNx.
static ExecCondition Xx (std::string key)
 Creates a key existence condition; see Type::kXx.

Member Enumeration Documentation

◆ Type

The comparison performed before executing the queued commands.

Enumerator
kIfEq 

The key contains a string equal to the expected value.

kIfNe 

The key is absent or contains a string different from the expected value.

kNx 

The key does not exist.

kXx 

The key exists, regardless of its value type.

Definition at line 30 of file command_options.hpp.

Member Function Documentation

◆ GetKey()

const std::string & storages::redis::ExecCondition::GetKey ( ) const
inline

Returns the key to check.

Definition at line 53 of file command_options.hpp.

◆ GetType()

Type storages::redis::ExecCondition::GetType ( ) const
inline

Returns the comparison to perform.

Definition at line 51 of file command_options.hpp.

◆ GetValue()

const std::string & storages::redis::ExecCondition::GetValue ( ) const
inline

Returns the comparison value for IfEq and IfNe, or an empty string for Nx and Xx.

Definition at line 55 of file command_options.hpp.


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