mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
bug: Fix SETINFO ensuring it is set-and-forget (#2915)
* Exexcute set-info without validation * Fix tests * Remove spaces from runtime.Version * fix typo * Send setinfo after auth * Add pipline * fix golangci * revert fixing typo * support sentinel
This commit is contained in:
@ -2,6 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/redis/go-redis/v9/internal/util"
|
||||
@ -44,3 +45,22 @@ func isLower(s string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func ReplaceSpaces(s string) string {
|
||||
// Pre-allocate a builder with the same length as s to minimize allocations.
|
||||
// This is a basic optimization; adjust the initial size based on your use case.
|
||||
var builder strings.Builder
|
||||
builder.Grow(len(s))
|
||||
|
||||
for _, char := range s {
|
||||
if char == ' ' {
|
||||
// Replace space with a hyphen.
|
||||
builder.WriteRune('-')
|
||||
} else {
|
||||
// Copy the character as-is.
|
||||
builder.WriteRune(char)
|
||||
}
|
||||
}
|
||||
|
||||
return builder.String()
|
||||
}
|
||||
|
Reference in New Issue
Block a user