Closed mrichmon closed 1 year ago
I'll try to support AsyncRedisCluster::redis
interface. It might not a good idea to expose hash slot number to client code, since it's implementation detail. Thanks for your suggestion!
Regards
Finally finished! However, instead of slot number, you need to use a hash-tag to specify the node. The behavior is consistent with RedisCluster
.
Please try the latest code on master branch. Sorry for the delay....
Regards
Confirmed working with:
std::string hashtag = "0";
auto myCommand = {"INFO"};
auto redis = myRedisCluster->redis(hashtag);
result = redis.command<sw::redis::OptionalString>(myCommand.begin(), myCommand.end()).get();
std::cout << (result.has_value() ? result.value() : "") << std::endl;
Is your feature request related to a problem? Please describe. In general, the async interfaces should mirror the synchronous interfaces. I have a need to perform operations such as INFO that require an instance of the Redis class or the AsyncRedis class. Unfortunately the AsyncRedisCluster class does not appear to provide a way to obtain an instance of a AsyncRedis class.
Describe the solution you'd like Provide the ability to obtain an instance of AsyncRedis from an AsyncRedisCluster instance. This should mirror the functionality provided by calling RedisCluster->redis(hashslot_id)
Alternate option: Provide a mechanism on AsyncRedisCluster to issue a generic command to a specific node. This could also be useful on RedisCluster to avoid the need to obtain an instance of Redis(). For example:
Is there an existing way to perform redis node-specific operations starting from an AsyncRedisCluster() instance?