9#include <userver/storages/redis/client_fwd.hpp>
10#include <userver/storages/redis/impl/base.hpp>
11#include <userver/storages/redis/impl/wait_connected_mode.hpp>
13#include <userver/storages/redis/subscription_token.hpp>
15USERVER_NAMESPACE_BEGIN
18class SubscribeSentinel;
21namespace storages::
redis {
44 virtual ~SubscribeClient();
46 virtual SubscriptionToken Subscribe(
48 SubscriptionToken::OnMessageCb on_message_cb,
52 SubscriptionToken Subscribe(std::string channel, SubscriptionToken::OnMessageCb on_message_cb) {
53 return Subscribe(std::move(channel), std::move(on_message_cb), {});
56 virtual SubscriptionToken Psubscribe(
58 SubscriptionToken::OnPmessageCb on_pmessage_cb,
62 virtual size_t ShardsCount()
const = 0;
63 virtual bool IsInClusterMode()
const = 0;
65 SubscriptionToken Psubscribe(std::string pattern, SubscriptionToken::OnPmessageCb on_pmessage_cb) {
66 return Psubscribe(std::move(pattern), std::move(on_pmessage_cb), {});
69 virtual SubscriptionToken Ssubscribe(
71 SubscriptionToken::OnMessageCb on_message_cb,
75 SubscriptionToken Ssubscribe(std::string channel, SubscriptionToken::OnMessageCb on_message_cb) {
76 return Ssubscribe(std::move(channel), std::move(on_message_cb), {});