userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
hpexpiretime_reply.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/redis/hpexpiretime_reply.hpp
4
/// @brief Typed reply for HPEXPIRETIME (per-hash-field absolute expiration
5
/// timestamp, millisecond 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 HPEXPIRETIME reply for a single field — absolute deadline (in
19
/// milliseconds since the epoch) or a "field is missing" / "field has no
20
/// expiration" sentinel.
21
///
22
/// Sibling of @c HexpiretimeReply for the milliseconds-precision command.
23
class
HpexpiretimeReply
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
HpexpiretimeReply(int64_t value);
34
HpexpiretimeReply(Status status);
35
36
/// @brief Parse a single HPEXPIRETIME element from the array reply.
37
static
HpexpiretimeReply
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
/// (with millisecond-precision underlying value). Throws
44
/// @c KeyHasNoExpirationException if the field has no expiration.
45
std::chrono::system_clock::time_point
GetDeadline
()
const
;
46
47
private
:
48
int64_t value_;
49
};
50
51
}
// namespace storages::redis
52
53
USERVER_NAMESPACE_END
userver
storages
redis
hpexpiretime_reply.hpp
Generated on
for userver by
Doxygen
1.17.0