userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
hexpiretime_reply.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/redis/hexpiretime_reply.hpp
4
/// @brief Typed reply for HEXPIRETIME (per-hash-field absolute expiration
5
/// timestamp, seconds precision).
6
7
#
include
<
chrono
>
8
#
include
<
cstdint
>
9
#
include
<
string
>
10
11
#
include
<
userver
/
storages
/
redis
/
fwd
.
hpp
>
12
#
include
<
userver
/
storages
/
redis
/
ttl_reply
.
hpp
>
13
14
USERVER_NAMESPACE_BEGIN
15
16
namespace
storages::
redis
{
17
18
/// @brief Parsed HEXPIRETIME reply for a single field — absolute deadline (in
19
/// seconds since the epoch) or a "field is missing" / "field has no
20
/// expiration" sentinel.
21
///
22
/// For millisecond-precision command (HPEXPIRETIME) use @c HpexpiretimeReply.
23
class
HexpiretimeReply
final
{
24
public
:
25
enum
class
Status : std::int8_t {
26
kFieldDoesNotExist = -2,
27
kFieldHasNoExpiration = -1,
28
};
29
30
static
constexpr
Status kFieldDoesNotExist = Status::kFieldDoesNotExist;
31
static
constexpr
Status kFieldHasNoExpiration = Status::kFieldHasNoExpiration;
32
33
explicit
HexpiretimeReply(int64_t value);
34
HexpiretimeReply(Status status);
35
36
/// @brief Parse a single HEXPIRETIME element from the array reply.
37
static
HexpiretimeReply
Parse
(ReplyData&& reply_data,
const
std::string& request_description = {});
38
39
bool
FieldExists()
const
;
40
bool
HasExpiration()
const
;
41
42
/// @brief Returns the absolute deadline as a @c system_clock::time_point.
43
/// Throws @c KeyHasNoExpirationException if the field has no expiration.
44
std::chrono::system_clock::time_point
GetDeadline
()
const
;
45
46
private
:
47
int64_t value_;
48
};
49
50
}
// namespace storages::redis
51
52
USERVER_NAMESPACE_END
userver
storages
redis
hexpiretime_reply.hpp
Generated on
for userver by
Doxygen
1.17.0