MCPcopy
hub / github.com/redis/go-redis / Get

Method Get

osscluster.go:1122–1133  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

1120}
1121
1122func (c *clusterStateHolder) Get(ctx context.Context) (*clusterState, error) {
1123 v := c.state.Load()
1124 if v == nil {
1125 return c.Reload(ctx)
1126 }
1127
1128 state := v.(*clusterState)
1129 if time.Since(state.createdAt) > c.reloadInterval {
1130 c.LazyReload()
1131 }
1132 return state, nil
1133}
1134
1135func (c *clusterStateHolder) ReloadOrGet(ctx context.Context) (*clusterState, error) {
1136 state, err := c.Reload(ctx)

Callers 1

ReloadOrGetMethod · 0.95

Calls 3

ReloadMethod · 0.95
LazyReloadMethod · 0.95
LoadMethod · 0.45

Tested by

no test coverage detected