userver: storages::redis Namespace Reference
Loading...
Searching...
No Matches
storages::redis Namespace Reference

Detailed Description

Redis client.

Classes

class  Client
 Redis client. More...
 
struct  Config
 
class  EmptyTransactionException
 
struct  GeoPoint
 
struct  MemberScore
 
class  NotStartedTransactionException
 
struct  Point
 
class  Request
 
class  RequestDataBase
 
class  RequestEval
 
class  RequestEvalSha
 
class  RequestScanData
 
class  RequestScanDataBase
 
class  ScanOptionsBase
 
class  ScanOptionsTmpl
 
struct  ScanReplyElem
 
struct  ScanReplyElem< ScanTag::kHscan >
 
struct  ScanReplyElem< ScanTag::kScan >
 
struct  ScanReplyElem< ScanTag::kSscan >
 
struct  ScanReplyElem< ScanTag::kZscan >
 
class  ScanRequest
 
class  SubscribeClient
 Client that allows subscribing to Redis channel messages. More...
 
class  SubscriptionToken
 RAII subscription guard, that is usually retrieved from storages::redis::SubscribeClient. More...
 
struct  To
 
class  Transaction
 

Typedefs

using RetryNilFromMaster = ::redis::RetryNilFromMaster
 
using ClientPtr = std::shared_ptr<Client>
 
using SubscribeClientPtr = std::shared_ptr<SubscribeClient>
 
using Longitude = ::redis::Longitude
 
using Latitude = ::redis::Latitude
 
using BoxWidth = ::redis::BoxWidth
 
using BoxHeight = ::redis::BoxHeight
 
using CommandControl = ::redis::CommandControl
 
using RangeOptions = ::redis::RangeOptions
 
using GeoaddArg = ::redis::GeoaddArg
 
using GeoradiusOptions = ::redis::GeoradiusOptions
 
using GeosearchOptions = ::redis::GeosearchOptions
 
using ZaddOptions = ::redis::ZaddOptions
 
using ScanOptions = ScanOptionsTmpl<ScanTag::kScan>
 
using SscanOptions = ScanOptionsTmpl<ScanTag::kSscan>
 
using HscanOptions = ScanOptionsTmpl<ScanTag::kHscan>
 
using ZscanOptions = ScanOptionsTmpl<ScanTag::kZscan>
 
using ReplyData = ::redis::ReplyData
 
using Reply = ::redis::Reply
 
using ReplyPtr = std::shared_ptr<Reply>
 
using ExpireReply = ::redis::ExpireReply
 
using TtlReply = ::redis::TtlReply
 
using RequestAppend = Request<size_t>
 
using RequestDbsize = Request<size_t>
 
using RequestDel = Request<size_t>
 
using RequestUnlink = Request<size_t>
 
using RequestEvalCommon = Request<ReplyData>
 
using RequestEvalShaCommon = Request<ReplyData>
 
using RequestScriptLoad = Request<std::string>
 
using RequestExec = Request<ReplyData, void>
 
using RequestExists = Request<size_t>
 
using RequestExpire = Request<ExpireReply>
 
using RequestGeoadd = Request<size_t>
 
using RequestGeoradius = Request<std::vector<GeoPoint>>
 
using RequestGeosearch = Request<std::vector<GeoPoint>>
 
using RequestGet = Request<std::optional<std::string>>
 
using RequestGetset = Request<std::optional<std::string>>
 
using RequestHdel = Request<size_t>
 
using RequestHexists = Request<size_t>
 
using RequestHget = Request<std::optional<std::string>>
 
using RequestHgetall = Request<std::unordered_map<std::string, std::string>>
 
using RequestHincrby = Request<int64_t>
 
using RequestHincrbyfloat = Request<double>
 
using RequestHkeys = Request<std::vector<std::string>>
 
using RequestHlen = Request<size_t>
 
using RequestHmget = Request<std::vector<std::optional<std::string>>>
 
using RequestHmset = Request<StatusOk, void>
 
using RequestHscan = ScanRequest<ScanTag::kHscan>
 
using RequestHset = Request<HsetReply>
 
using RequestHsetnx = Request<size_t, bool>
 
using RequestHvals = Request<std::vector<std::string>>
 
using RequestIncr = Request<int64_t>
 
using RequestKeys = Request<std::vector<std::string>>
 
using RequestLindex = Request<std::optional<std::string>>
 
using RequestLlen = Request<size_t>
 
using RequestLpop = Request<std::optional<std::string>>
 
using RequestLpush = Request<size_t>
 
using RequestLpushx = Request<size_t>
 
using RequestLrange = Request<std::vector<std::string>>
 
using RequestLrem = Request<size_t>
 
using RequestLtrim = Request<StatusOk, void>
 
using RequestMget = Request<std::vector<std::optional<std::string>>>
 
using RequestMset = Request<StatusOk, void>
 
using RequestPersist = Request<PersistReply>
 
using RequestPexpire = Request<ExpireReply>
 
using RequestPing = Request<StatusPong, void>
 
using RequestPingMessage = Request<std::string>
 
using RequestPublish = Request<size_t>
 
using RequestRename = Request<StatusOk, void>
 
using RequestRpop = Request<std::optional<std::string>>
 
using RequestRpush = Request<size_t>
 
using RequestRpushx = Request<size_t>
 
using RequestSadd = Request<size_t>
 
using RequestScan = ScanRequest<ScanTag::kScan>
 
using RequestScard = Request<size_t>
 
using RequestSet = Request<StatusOk, void>
 
using RequestSetIfExist = Request<std::optional<StatusOk>, bool>
 
using RequestSetIfNotExist = Request<std::optional<StatusOk>, bool>
 
using RequestSetOptions = Request<SetReply>
 
using RequestSetex = Request<StatusOk, void>
 
using RequestSismember = Request<size_t>
 
using RequestSmembers = Request<std::unordered_set<std::string>>
 
using RequestSrandmember = Request<std::optional<std::string>>
 
using RequestSrandmembers = Request<std::vector<std::string>>
 
using RequestSrem = Request<size_t>
 
using RequestSscan = ScanRequest<ScanTag::kSscan>
 
using RequestStrlen = Request<size_t>
 
using RequestTime = Request<std::chrono::system_clock::time_point>
 
using RequestTtl = Request<TtlReply>
 
using RequestType = Request<KeyType>
 
using RequestZadd = Request<size_t>
 
using RequestZaddIncr = Request<double>
 
using RequestZaddIncrExisting = Request<std::optional<double>>
 
using RequestZcard = Request<size_t>
 
using RequestZcount = Request<size_t>
 
using RequestZrange = Request<std::vector<std::string>>
 
using RequestZrangeWithScores = Request<std::vector<MemberScore>>
 
using RequestZrangebyscore = Request<std::vector<std::string>>
 
using RequestZrangebyscoreWithScores = Request<std::vector<MemberScore>>
 
using RequestZrem = Request<size_t>
 
using RequestZremrangebyrank = Request<size_t>
 
using RequestZremrangebyscore = Request<size_t>
 
using RequestZscan = ScanRequest<ScanTag::kZscan>
 
using RequestZscore = Request<std::optional<double>>
 
using TransactionPtr = std::unique_ptr<Transaction>
 

Enumerations

enum class  PubShard {
  kZeroShard ,
  kRoundRobin
}
 
enum class  KeyType {
  kNone ,
  kString ,
  kList ,
  kSet ,
  kZset ,
  kHash ,
  kStream
}
 
enum class  HsetReply {
  kCreated ,
  kUpdated
}
 
enum class  PersistReply {
  kKeyOrTimeoutNotFound ,
  kTimeoutRemoved
}
 
enum class  SetReply {
  kSet ,
  kNotSet
}
 
enum class  StatusOk { kOk }
 
enum class  StatusPong { kPong }
 
enum class  ScanTag {
  kScan ,
  kSscan ,
  kHscan ,
  kZscan
}
 

Functions

std::string CreateTmpKey (const std::string &key, std::string prefix)
 
void PutArg (::redis::CmdArgs::CmdArgsArray &args_, std::optional< ScanOptionsBase::Match > arg)
 
void PutArg (::redis::CmdArgs::CmdArgsArray &args_, std::optional< ScanOptionsBase::Count > arg)
 
KeyType ParseKeyType (std::string_view str)
 
std::string ToString (KeyType key_type)
 
std::vector< std::string > ParseReplyDataArray (ReplyData &&array_data, const std::string &request_description, To< std::vector< std::string > >)
 
std::vector< std::optional< std::string > > ParseReplyDataArray (ReplyData &&array_data, const std::string &request_description, To< std::vector< std::optional< std::string > > >)
 
std::vector< std::pair< std::string, std::string > > ParseReplyDataArray (ReplyData &&array_data, const std::string &request_description, To< std::vector< std::pair< std::string, std::string > > >)
 
std::vector< MemberScoreParseReplyDataArray (ReplyData &&array_data, const std::string &request_description, To< std::vector< MemberScore > >)
 
std::vector< GeoPointParseReplyDataArray (ReplyData &&array_data, const std::string &request_description, To< std::vector< GeoPoint > >)
 
std::string Parse (ReplyData &&reply_data, const std::string &request_description, To< std::string >)
 
double Parse (ReplyData &&reply_data, const std::string &request_description, To< double >)
 
size_t Parse (ReplyData &&reply_data, const std::string &request_description, To< size_t >)
 
bool Parse (ReplyData &&reply_data, const std::string &request_description, To< size_t, bool >)
 
int64_t Parse (ReplyData &&reply_data, const std::string &request_description, To< int64_t >)
 
std::chrono::system_clock::time_point Parse (ReplyData &&reply_data, const std::string &request_description, To< std::chrono::system_clock::time_point >)
 
HsetReply Parse (ReplyData &&reply_data, const std::string &request_description, To< HsetReply >)
 
PersistReply Parse (ReplyData &&reply_data, const std::string &request_description, To< PersistReply >)
 
KeyType Parse (ReplyData &&reply_data, const std::string &request_description, To< KeyType >)
 
void Parse (ReplyData &&reply_data, const std::string &request_description, To< StatusOk, void >)
 
bool Parse (ReplyData &&reply_data, const std::string &request_description, To< std::optional< StatusOk >, bool >)
 
void Parse (ReplyData &&reply_data, const std::string &request_description, To< StatusPong, void >)
 
SetReply Parse (ReplyData &&reply_data, const std::string &request_description, To< SetReply >)
 
std::unordered_set< std::string > Parse (ReplyData &&reply_data, const std::string &request_description, To< std::unordered_set< std::string > >)
 
std::unordered_map< std::string, std::string > Parse (ReplyData &&reply_data, const std::string &request_description, To< std::unordered_map< std::string, std::string > >)
 
ReplyData Parse (ReplyData &&reply_data, const std::string &request_description, To< ReplyData >)
 
template<typename Result , typename ReplyType = Result>
std::enable_if_t< impl::HasParseFunctionFromRedisReply< Result, ReplyType >::value, ReplyType > Parse (ReplyData &&reply_data, const std::string &request_description, To< Result, ReplyType >)
 
template<typename T >
std::vector< T > Parse (ReplyData &&reply_data, const std::string &request_description, To< std::vector< T > >)
 
template<typename T >
std::optional< T > Parse (ReplyData &&reply_data, const std::string &request_description, To< std::optional< T > >)
 
template<typename Result , typename ReplyType = Result>
ReplyType ParseReply (ReplyPtr reply, const std::string &request_description={})
 

Variables

constexpr RetryNilFromMaster kRetryNilFromMaster {}
 
const dynamic_config::Key< ConfigkConfig
 

Typedef Documentation

◆ BoxHeight

using storages::redis::BoxHeight = ::redis::BoxHeight

Definition at line 19 of file command_options.hpp.

◆ BoxWidth

using storages::redis::BoxWidth = ::redis::BoxWidth

Definition at line 18 of file command_options.hpp.

◆ ClientPtr

using storages::redis::ClientPtr = std::shared_ptr<Client>

Definition at line 10 of file client_fwd.hpp.

◆ CommandControl

using storages::redis::CommandControl = ::redis::CommandControl

Definition at line 20 of file command_options.hpp.

◆ ExpireReply

using storages::redis::ExpireReply = ::redis::ExpireReply

Definition at line 19 of file reply_types.hpp.

◆ GeoaddArg

using storages::redis::GeoaddArg = ::redis::GeoaddArg

Definition at line 22 of file command_options.hpp.

◆ GeoradiusOptions

using storages::redis::GeoradiusOptions = ::redis::GeoradiusOptions

Definition at line 23 of file command_options.hpp.

◆ GeosearchOptions

using storages::redis::GeosearchOptions = ::redis::GeosearchOptions

Definition at line 24 of file command_options.hpp.

◆ HscanOptions

Definition at line 93 of file command_options.hpp.

◆ Latitude

using storages::redis::Latitude = ::redis::Latitude

Definition at line 17 of file command_options.hpp.

◆ Longitude

using storages::redis::Longitude = ::redis::Longitude

Definition at line 16 of file command_options.hpp.

◆ RangeOptions

using storages::redis::RangeOptions = ::redis::RangeOptions

Definition at line 21 of file command_options.hpp.

◆ Reply

using storages::redis::Reply = ::redis::Reply

Definition at line 15 of file reply_fwd.hpp.

◆ ReplyData

using storages::redis::ReplyData = ::redis::ReplyData

Definition at line 14 of file reply_fwd.hpp.

◆ ReplyPtr

using storages::redis::ReplyPtr = std::shared_ptr<Reply>

Definition at line 17 of file reply_fwd.hpp.

◆ RequestAppend

Definition at line 153 of file request.hpp.

◆ RequestDbsize

Definition at line 154 of file request.hpp.

◆ RequestDel

Definition at line 155 of file request.hpp.

◆ RequestEvalCommon

Definition at line 157 of file request.hpp.

◆ RequestEvalShaCommon

Definition at line 158 of file request.hpp.

◆ RequestExec

using storages::redis::RequestExec = Request<ReplyData, void>

Definition at line 160 of file request.hpp.

◆ RequestExists

Definition at line 161 of file request.hpp.

◆ RequestExpire

Definition at line 162 of file request.hpp.

◆ RequestGeoadd

Definition at line 163 of file request.hpp.

◆ RequestGeoradius

Definition at line 164 of file request.hpp.

◆ RequestGeosearch

Definition at line 165 of file request.hpp.

◆ RequestGet

using storages::redis::RequestGet = Request<std::optional<std::string>>

Definition at line 166 of file request.hpp.

◆ RequestGetset

using storages::redis::RequestGetset = Request<std::optional<std::string>>

Definition at line 167 of file request.hpp.

◆ RequestHdel

Definition at line 168 of file request.hpp.

◆ RequestHexists

Definition at line 169 of file request.hpp.

◆ RequestHget

using storages::redis::RequestHget = Request<std::optional<std::string>>

Definition at line 170 of file request.hpp.

◆ RequestHgetall

using storages::redis::RequestHgetall = Request<std::unordered_map<std::string, std::string>>

Definition at line 171 of file request.hpp.

◆ RequestHincrby

Definition at line 172 of file request.hpp.

◆ RequestHincrbyfloat

Definition at line 173 of file request.hpp.

◆ RequestHkeys

using storages::redis::RequestHkeys = Request<std::vector<std::string>>

Definition at line 174 of file request.hpp.

◆ RequestHlen

Definition at line 175 of file request.hpp.

◆ RequestHmget

using storages::redis::RequestHmget = Request<std::vector<std::optional<std::string>>>

Definition at line 176 of file request.hpp.

◆ RequestHmset

using storages::redis::RequestHmset = Request<StatusOk, void>

Definition at line 177 of file request.hpp.

◆ RequestHscan

using storages::redis::RequestHscan = ScanRequest<ScanTag::kHscan>

Definition at line 178 of file request.hpp.

◆ RequestHset

Definition at line 179 of file request.hpp.

◆ RequestHsetnx

using storages::redis::RequestHsetnx = Request<size_t, bool>

Definition at line 180 of file request.hpp.

◆ RequestHvals

using storages::redis::RequestHvals = Request<std::vector<std::string>>

Definition at line 181 of file request.hpp.

◆ RequestIncr

Definition at line 182 of file request.hpp.

◆ RequestKeys

using storages::redis::RequestKeys = Request<std::vector<std::string>>

Definition at line 183 of file request.hpp.

◆ RequestLindex

using storages::redis::RequestLindex = Request<std::optional<std::string>>

Definition at line 184 of file request.hpp.

◆ RequestLlen

Definition at line 185 of file request.hpp.

◆ RequestLpop

using storages::redis::RequestLpop = Request<std::optional<std::string>>

Definition at line 186 of file request.hpp.

◆ RequestLpush

Definition at line 187 of file request.hpp.

◆ RequestLpushx

Definition at line 188 of file request.hpp.

◆ RequestLrange

using storages::redis::RequestLrange = Request<std::vector<std::string>>

Definition at line 189 of file request.hpp.

◆ RequestLrem

Definition at line 190 of file request.hpp.

◆ RequestLtrim

using storages::redis::RequestLtrim = Request<StatusOk, void>

Definition at line 191 of file request.hpp.

◆ RequestMget

using storages::redis::RequestMget = Request<std::vector<std::optional<std::string>>>

Definition at line 192 of file request.hpp.

◆ RequestMset

using storages::redis::RequestMset = Request<StatusOk, void>

Definition at line 193 of file request.hpp.

◆ RequestPersist

Definition at line 194 of file request.hpp.

◆ RequestPexpire

Definition at line 195 of file request.hpp.

◆ RequestPing

using storages::redis::RequestPing = Request<StatusPong, void>

Definition at line 196 of file request.hpp.

◆ RequestPingMessage

Definition at line 197 of file request.hpp.

◆ RequestPublish

Definition at line 198 of file request.hpp.

◆ RequestRename

using storages::redis::RequestRename = Request<StatusOk, void>

Definition at line 199 of file request.hpp.

◆ RequestRpop

using storages::redis::RequestRpop = Request<std::optional<std::string>>

Definition at line 200 of file request.hpp.

◆ RequestRpush

Definition at line 201 of file request.hpp.

◆ RequestRpushx

Definition at line 202 of file request.hpp.

◆ RequestSadd

Definition at line 203 of file request.hpp.

◆ RequestScan

using storages::redis::RequestScan = ScanRequest<ScanTag::kScan>

Definition at line 204 of file request.hpp.

◆ RequestScard

Definition at line 205 of file request.hpp.

◆ RequestScriptLoad

Definition at line 159 of file request.hpp.

◆ RequestSet

using storages::redis::RequestSet = Request<StatusOk, void>

Definition at line 206 of file request.hpp.

◆ RequestSetex

using storages::redis::RequestSetex = Request<StatusOk, void>

Definition at line 210 of file request.hpp.

◆ RequestSetIfExist

using storages::redis::RequestSetIfExist = Request<std::optional<StatusOk>, bool>

Definition at line 207 of file request.hpp.

◆ RequestSetIfNotExist

using storages::redis::RequestSetIfNotExist = Request<std::optional<StatusOk>, bool>

Definition at line 208 of file request.hpp.

◆ RequestSetOptions

Definition at line 209 of file request.hpp.

◆ RequestSismember

Definition at line 211 of file request.hpp.

◆ RequestSmembers

using storages::redis::RequestSmembers = Request<std::unordered_set<std::string>>

Definition at line 212 of file request.hpp.

◆ RequestSrandmember

using storages::redis::RequestSrandmember = Request<std::optional<std::string>>

Definition at line 213 of file request.hpp.

◆ RequestSrandmembers

using storages::redis::RequestSrandmembers = Request<std::vector<std::string>>

Definition at line 214 of file request.hpp.

◆ RequestSrem

Definition at line 215 of file request.hpp.

◆ RequestSscan

using storages::redis::RequestSscan = ScanRequest<ScanTag::kSscan>

Definition at line 216 of file request.hpp.

◆ RequestStrlen

Definition at line 217 of file request.hpp.

◆ RequestTime

using storages::redis::RequestTime = Request<std::chrono::system_clock::time_point>

Definition at line 218 of file request.hpp.

◆ RequestTtl

Definition at line 219 of file request.hpp.

◆ RequestType

Definition at line 220 of file request.hpp.

◆ RequestUnlink

Definition at line 156 of file request.hpp.

◆ RequestZadd

Definition at line 221 of file request.hpp.

◆ RequestZaddIncr

Definition at line 222 of file request.hpp.

◆ RequestZaddIncrExisting

using storages::redis::RequestZaddIncrExisting = Request<std::optional<double>>

Definition at line 223 of file request.hpp.

◆ RequestZcard

Definition at line 224 of file request.hpp.

◆ RequestZcount

Definition at line 225 of file request.hpp.

◆ RequestZrange

using storages::redis::RequestZrange = Request<std::vector<std::string>>

Definition at line 226 of file request.hpp.

◆ RequestZrangebyscore

using storages::redis::RequestZrangebyscore = Request<std::vector<std::string>>

Definition at line 228 of file request.hpp.

◆ RequestZrangebyscoreWithScores

Definition at line 229 of file request.hpp.

◆ RequestZrangeWithScores

Definition at line 227 of file request.hpp.

◆ RequestZrem

Definition at line 230 of file request.hpp.

◆ RequestZremrangebyrank

Definition at line 231 of file request.hpp.

◆ RequestZremrangebyscore

Definition at line 232 of file request.hpp.

◆ RequestZscan

using storages::redis::RequestZscan = ScanRequest<ScanTag::kZscan>

Definition at line 233 of file request.hpp.

◆ RequestZscore

using storages::redis::RequestZscore = Request<std::optional<double>>

Definition at line 234 of file request.hpp.

◆ RetryNilFromMaster

using storages::redis::RetryNilFromMaster = ::redis::RetryNilFromMaster

Definition at line 29 of file client.hpp.

◆ ScanOptions

Definition at line 91 of file command_options.hpp.

◆ SscanOptions

Definition at line 92 of file command_options.hpp.

◆ SubscribeClientPtr

using storages::redis::SubscribeClientPtr = std::shared_ptr<SubscribeClient>

Definition at line 13 of file client_fwd.hpp.

◆ TransactionPtr

using storages::redis::TransactionPtr = std::unique_ptr<Transaction>

Definition at line 305 of file transaction.hpp.

◆ TtlReply

using storages::redis::TtlReply = ::redis::TtlReply

Definition at line 112 of file reply_types.hpp.

◆ ZaddOptions

using storages::redis::ZaddOptions = ::redis::ZaddOptions

Definition at line 25 of file command_options.hpp.

◆ ZscanOptions

Definition at line 94 of file command_options.hpp.

Enumeration Type Documentation

◆ HsetReply

enum class storages::redis::HsetReply
strong

Definition at line 21 of file reply_types.hpp.

◆ KeyType

enum class storages::redis::KeyType
strong

Definition at line 10 of file key_type.hpp.

◆ PersistReply

enum class storages::redis::PersistReply
strong

Definition at line 81 of file reply_types.hpp.

◆ PubShard

enum class storages::redis::PubShard
strong

Definition at line 24 of file client.hpp.

◆ ScanTag

enum class storages::redis::ScanTag
strong

Definition at line 7 of file scan_tag.hpp.

◆ SetReply

enum class storages::redis::SetReply
strong

Definition at line 106 of file reply_types.hpp.

◆ StatusOk

enum class storages::redis::StatusOk
strong

Definition at line 108 of file reply_types.hpp.

◆ StatusPong

enum class storages::redis::StatusPong
strong

Definition at line 110 of file reply_types.hpp.

Function Documentation

◆ Parse() [1/3]

template<typename Result , typename ReplyType = Result>
std::enable_if_t< impl::HasParseFunctionFromRedisReply< Result, ReplyType >::value, ReplyType > storages::redis::Parse ( ReplyData && reply_data,
const std::string & request_description,
To< Result, ReplyType >  )

Definition at line 128 of file parse_reply.hpp.

◆ Parse() [2/3]

template<typename T >
std::optional< T > storages::redis::Parse ( ReplyData && reply_data,
const std::string & request_description,
To< std::optional< T > >  )

Definition at line 143 of file parse_reply.hpp.

◆ Parse() [3/3]

template<typename T >
std::vector< T > storages::redis::Parse ( ReplyData && reply_data,
const std::string & request_description,
To< std::vector< T > >  )

Definition at line 134 of file parse_reply.hpp.

◆ ParseReply()

template<typename Result , typename ReplyType = Result>
ReplyType storages::redis::ParseReply ( ReplyPtr reply,
const std::string & request_description = {} )

Definition at line 151 of file parse_reply.hpp.

Variable Documentation

◆ kRetryNilFromMaster

constexpr RetryNilFromMaster storages::redis::kRetryNilFromMaster {}
inlineconstexpr

Definition at line 31 of file client.hpp.