diff --git a/cluster.go b/cluster.go index 32e406e4..0e97da10 100644 --- a/cluster.go +++ b/cluster.go @@ -374,6 +374,11 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient { return c } +// Options returns read-only Options that were used to create the client. +func (c *ClusterClient) Options() *ClusterOptions { + return c.opt +} + func (c *ClusterClient) state() *clusterState { v := c._state.Load() if v != nil { diff --git a/redis.go b/redis.go index 04c9a7b8..262e6761 100644 --- a/redis.go +++ b/redis.go @@ -21,6 +21,11 @@ func (c *baseClient) String() string { return fmt.Sprintf("Redis<%s db:%d>", c.getAddr(), c.opt.DB) } +// Options returns read-only Options that were used to create the client. +func (c *baseClient) Options() *Options { + return c.opt +} + func (c *baseClient) conn() (*pool.Conn, bool, error) { cn, isNew, err := c.connPool.Get() if err != nil { diff --git a/ring.go b/ring.go index 961b7780..6b4d77b1 100644 --- a/ring.go +++ b/ring.go @@ -158,6 +158,11 @@ func NewRing(opt *RingOptions) *Ring { return ring } +// Options returns read-only Options that were used to create the client. +func (c *Ring) Options() *RingOptions { + return c.opt +} + // PoolStats returns accumulated connection pool stats. func (c *Ring) PoolStats() *PoolStats { var acc PoolStats