How to pass redis Connection Manager and Cluster Manager to same struct

Hello,

To give context, I had a logic written out first for redis ConnectionManager to send over the commands and it's several methods.

Recently I've added Redis cluster support and interact with it via the ClusterConnection, and set the cluster manage into another file, with basically copying the original file and making the type adjustments .

I'd like to know what would be best case to not duplicate the code, and just pass ConnectionManager or ClusterConnection with keeping the logic in one file without too much fuss?

Thank you!

This is a job for generics.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.