How does the user code perceive the current master and slave of the cluster after the master-slave switch of the redis sentinel cluster?

how does the user code perceive which instance of the current master is after the master-slave switch of the redis sentinel cluster? Thus write to the current main library.
Thank you for your guidance ~

Feb.28,2021
Menu