Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 316 forks source link

ClusterPipeline is not exported as part of rediscluster #441

Closed FranGM closed 3 years ago

FranGM commented 3 years ago

Hi,

I'm looking into adding clustered redis support to some of our applications and I'm currently hitting a bit of a snag.

Our current usage around RedisClient involves subclassing it so we can add instrumentation around our redis usage every time we run a command. We also do the same with pipelines, instead of using Pipeline directly we use a subclass of it that adds instrumentation.

We're trying to apply the same logic here and it works well enough with ClusterRedisClient, but I just realised that the rediscluster package doesn't really export ClusterPipeline, (https://github.com/Grokzen/redis-py-cluster/blob/73f27edf7ceb4a408b3008ef7d82dac570ab9c6a/rediscluster/__init__.py#L39-L54) so we can't really subclass it.

We can just do from rediscluster.pipeline import ClusterPipeline but it seems cleaner if it's all exported from rediscluster directly.

Is this an intentional design decision or could it just be added to support this use case? I'll get a PR ready just in case it's the latter 😄

Thanks!