package util
Import Path
github.com/redis/go-redis/v9/internal/util (on go.dev)
Dependency Relation
imports 5 packages, and imported by 5 packages
Package-Level Type Names (total 2)
AtomicMax is a thread-safe max container
- hasValue indicator true if a value was equal to or greater than threshold
- optional threshold for minimum accepted max value
- if threshold is not used, initialization-free
- —
- wait-free CompareAndSwap mechanic
Max returns current max and value-present flag
- hasValue true indicates that value reflects a Value invocation
- hasValue false: value is zero-value
- Thread-safe
Max1 returns current maximum whether zero-value or set by Value
- threshold is ignored
- Thread-safe
Value updates the container with a possible max value
- isNewMax is true if:
- — value is equal to or greater than any threshold and
- — invocation recorded the first 0 or
- — a new max
- upon return, Max and Max1 are guaranteed to reflect the invocation
- the return order of concurrent Value invocations is not guaranteed
- Thread-safe
func NewAtomicMax() (atomicMax *AtomicMax)
AtomicMin is a thread-safe Min container
- hasValue indicator true if a value was equal to or greater than threshold
- optional threshold for minimum accepted Min value
- —
- wait-free CompareAndSwap mechanic
Min returns current min and value-present flag
- hasValue true indicates that value reflects a Value invocation
- hasValue false: value is zero-value
- Thread-safe
Min1 returns current Minimum whether zero-value or set by Value
- threshold is ignored
- Thread-safe
Value updates the container with a possible Min value
- isNewMin is true if:
- — value is equal to or greater than any threshold and
- — invocation recorded the first 0 or
- — a new Min
- upon return, Min and Min1 are guaranteed to reflect the invocation
- the return order of concurrent Value invocations is not guaranteed
- Thread-safe
func NewAtomicMin() (atomicMin *AtomicMin)
Package-Level Functions (total 12)
BytesToString converts byte slice to string.
MustParseFloat is like ParseFloat but panics on parse errors.
NewAtomicMax returns a thread-safe max container
- if threshold is not used, AtomicMax is initialization-free
NewAtomicMin returns a thread-safe Min container
- if threshold is not used, AtomicMin is initialization-free
func ParseFloat(b []byte, bitSize int) (float64, error)
ParseFloat parses a Redis RESP3 float reply into a Go float64,
handling "inf", "-inf", "nan" per Redis conventions.
SafeIntToInt32 safely converts an int to int32, returning an error if overflow would occur.
StringToBytes converts string to byte slice.
Type Parameters:
T: any
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |