docs: README update to highlight how to disable sending client identification (#2913)

This commit is contained in:
ofekshenawa 2024-02-20 16:37:22 +02:00 committed by GitHub
parent b5a9e5d2c6
commit 99527f0ac1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,7 @@ ACLs
autoload autoload
autoloader autoloader
autoloading autoloading
analytics
Autoloading Autoloading
backend backend
backends backends
@ -13,6 +14,7 @@ customizable
Customizable Customizable
dataset dataset
de de
DisableIdentity
ElastiCache ElastiCache
extensibility extensibility
FPM FPM
@ -43,6 +45,7 @@ RocksDB
runtime runtime
SHA SHA
sharding sharding
SETNAME
SSL SSL
struct struct
stunnel stunnel

View File

@ -161,6 +161,30 @@ func ExampleClient() *redis.Client {
``` ```
### Advanced Configuration
go-redis supports extending the client identification phase to allow projects to send their own custom client identification.
#### Default Client Identification
By default, go-redis automatically sends the client library name and version during the connection process. This feature is available in redis-server as of version 7.2. As a result, the command is "fire and forget", meaning it should fail silently, in the case that the redis server does not support this feature.
#### Disabling Identity Verification
When connection identity verification is not required or needs to be explicitly disabled, a `DisableIndentity` configuration option exists. In V10 of this library, `DisableIndentity` will become `DisableIdentity` in order to fix the associated typo.
To disable verification, set the `DisableIndentity` option to `true` in the Redis client options:
```go
rdb := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "",
DB: 0,
DisableIndentity: true, // Disable set-info on connect
})
```
## Contributing ## Contributing
Please see [out contributing guidelines](CONTRIBUTING.md) to help us improve this library! Please see [out contributing guidelines](CONTRIBUTING.md) to help us improve this library!