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 {
13public:
14 explicit RequestEval(RequestEvalCommon&& request) : request_(std::move(request)) {}
15
16 void Wait() { request_.Wait(); }
17
18 void IgnoreResult() const { request_.IgnoreResult(); }
19
20 ReplyType Get(const std::string& request_description = {}) {
21 return ParseReply<ScriptResult, ReplyType>(request_.GetRaw(), request_description);
22 }
23
24 /// @cond
25 /// Internal helper for WaitAny/WaitAll
26 engine::impl::ContextAccessor* TryGetContextAccessor() noexcept { return request_.TryGetContextAccessor(); }
27 /// @endcond
28
29private:
30 RequestEvalCommon request_;
31};
32
33} // namespace storages::redis
34
35USERVER_NAMESPACE_END