userver: storages::redis::MsetexOptions Struct Reference
Loading...
Searching...
No Matches
storages::redis::MsetexOptions Struct Reference

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

Detailed Description

Options for MSETEX (NX/XX combined with EX/PX/EXAT/PXAT/KEEPTTL).

Definition at line 219 of file command_options.hpp.

Public Types

enum class  Exist : std::uint8_t {
  kSetAlways ,
  kSetIfNoneExist ,
  kSetIfAllExist
}
 Existence precondition for the affected keys. More...
enum class  TtlAction : std::uint8_t {
  kNone ,
  kSetSeconds ,
  kSetMilliseconds ,
  kSetAtSeconds ,
  kSetAtMilliseconds ,
  kKeepTtl
}
 What TTL clause to attach to the new values. More...

Public Member Functions

MsetexOptionsOnlyIfNoneOfKeysExist () &
 Chainable modifier — NX: write only if none of the affected keys currently exist.
MsetexOptionsOnlyIfAllKeysExist () &
 Chainable modifier — XX: write only if all of the affected keys currently exist.
MsetexOptions OnlyIfNoneOfKeysExist () &&
 NX (rvalue overload).
MsetexOptions OnlyIfAllKeysExist () &&
 XX (rvalue overload).

Static Public Member Functions

static MsetexOptions NoTtl ()
 No TTL clause on the wire — server applies default behavior.
static MsetexOptions KeepTtl ()
 KEEPTTL — keep the existing TTL of each key if any.
static MsetexOptions Expire (std::chrono::milliseconds ttl)
 Set TTL to a relative duration. Posted on the wire as PX (ms-precision).
static MsetexOptions ExpireAt (std::chrono::system_clock::time_point deadline)
 Set TTL to an absolute deadline. Posted on the wire as PXAT (ms-precision).

Public Attributes

Exist exist {Exist::kSetAlways}
TtlAction ttl_action {TtlAction::kNone}
std::chrono::milliseconds ttl {0}

Member Enumeration Documentation

◆ Exist

enum class storages::redis::MsetexOptions::Exist : std::uint8_t
strong

Existence precondition for the affected keys.

Enumerator
kSetAlways 

No precondition (default).

kSetIfNoneExist 

NX — set only if none of the affected keys currently exists.

kSetIfAllExist 

XX — set only if all of the affected keys currently exist.

Definition at line 221 of file command_options.hpp.

◆ TtlAction

enum class storages::redis::MsetexOptions::TtlAction : std::uint8_t
strong

What TTL clause to attach to the new values.

Enumerator
kNone 

No TTL clause on the wire — server applies default behavior.

kSetSeconds 

EX seconds.

kSetMilliseconds 

PX milliseconds.

kSetAtSeconds 

EXAT unix-ts-sec.

kSetAtMilliseconds 

PXAT unix-ts-ms.

kKeepTtl 

KEEPTTL — keep the existing TTL of each key if any; ttl is ignored.

Definition at line 230 of file command_options.hpp.

Member Function Documentation

◆ OnlyIfAllKeysExist() [1/2]

MsetexOptions & storages::redis::MsetexOptions::OnlyIfAllKeysExist ( ) &
inline

Chainable modifier — XX: write only if all of the affected keys currently exist.

Definition at line 266 of file command_options.hpp.

◆ OnlyIfAllKeysExist() [2/2]

MsetexOptions storages::redis::MsetexOptions::OnlyIfAllKeysExist ( ) &&
inline

XX (rvalue overload).

Definition at line 276 of file command_options.hpp.

◆ OnlyIfNoneOfKeysExist() [1/2]

MsetexOptions & storages::redis::MsetexOptions::OnlyIfNoneOfKeysExist ( ) &
inline

Chainable modifier — NX: write only if none of the affected keys currently exist.

Definition at line 260 of file command_options.hpp.

◆ OnlyIfNoneOfKeysExist() [2/2]

MsetexOptions storages::redis::MsetexOptions::OnlyIfNoneOfKeysExist ( ) &&
inline

NX (rvalue overload).

Definition at line 271 of file command_options.hpp.

Member Data Documentation

◆ exist

Exist storages::redis::MsetexOptions::exist {Exist::kSetAlways}

Definition at line 245 of file command_options.hpp.

◆ ttl

std::chrono::milliseconds storages::redis::MsetexOptions::ttl {0}

Definition at line 247 of file command_options.hpp.

◆ ttl_action

TtlAction storages::redis::MsetexOptions::ttl_action {TtlAction::kNone}

Definition at line 246 of file command_options.hpp.


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