userver: userver/storages/redis/request_eval.hpp Source File
Loading...
Searching...
No Matches
request_eval.hpp
1#pragma once
2
3#include <userver/storages/redis/parse_reply.hpp>
4#include <userver/storages/redis/reply.hpp>
5#include <userver/storages/redis/request.hpp>
6
7USERVER_NAMESPACE_BEGIN
8
9namespace storages::redis {
10
11template <typename ScriptResult, typename ReplyType = ScriptResult>
12class [[nodiscard]] RequestEval final {
13 public:
14 explicit RequestEval(RequestEvalCommon&& request)
15 : request_(std::move(request)) {}
16
17 void Wait() { request_.Wait(); }
18
19 void IgnoreResult() const { request_.IgnoreResult(); }
20
21 ReplyType Get(const std::string& request_description = {}) {
22 return ParseReply<ScriptResult, ReplyType>(request_.GetRaw(),
23 request_description);
24 }
25
26 /// @cond
27 /// Internal helper for WaitAny/WaitAll
28 engine::impl::ContextAccessor* TryGetContextAccessor() noexcept {
29 return request_.TryGetContextAccessor();
30 }
31 /// @endcond
32
33 private:
34 RequestEvalCommon request_;
35};
36
37} // namespace storages::redis
38
39USERVER_NAMESPACE_END