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

Method GetState

internal/pool/conn_state.go:142–144  ·  view source on GitHub ↗

GetState returns the current state (lock-free read). This is the hot path - optimized for zero allocations and minimal overhead. Note: Zero allocations applies to state reads; converting the returned state to a string (via String()) may allocate if the state is unknown.

()

Source from the content-addressed store, hash-verified

140// Note: Zero allocations applies to state reads; converting the returned state to a string
141// (via String()) may allocate if the state is unknown.
142func (sm *ConnStateMachine) GetState() ConnState {
143 return ConnState(sm.state.Load())
144}
145
146// TryTransitionFast is an optimized version for the hot path (Get/Put operations).
147// It only handles simple state transitions without waiter notification.

Calls 2

ConnStateTypeAlias · 0.85
LoadMethod · 0.45