Connection

CLIENT SETINFO

Set client library name and version information.

The CLIENT SETINFO command sets client library name and version information that will be shown in CLIENT LIST and CLIENT INFO commands. This helps identify which client library is being used and is useful for debugging and monitoring.

Arguments

attributebody'LIB-NAME' | 'LIB-VER'required

The attribute to set:

  • LIB-NAME or lib-name: Library name
  • LIB-VER or lib-ver: Library version
valuebodystringrequired

The value to set for the attribute.

Response

stringrequired

Returns OK if the attribute was successfully set.

Set Library Name
// Set the library nameawait redis.clientSetInfo("LIB-NAME", "redis-js");// Returns: "OK"
Set Library Version
// Set the library versionawait redis.clientSetInfo("LIB-VER", "1.0.0");// Returns: "OK"
Lowercase Attributes
// Attributes are case-insensitiveawait redis.clientSetInfo("lib-name", "redis-js");await redis.clientSetInfo("lib-ver", "2.0.0");
With Custom Suffix
// Common pattern: include wrapper or framework infoawait redis.clientSetInfo("LIB-NAME", "redis-js(upstash_v1.0.0)");await redis.clientSetInfo("LIB-VER", "1.0.0");
Complete Setup
// Set both library name and versionawait redis.clientSetInfo("LIB-NAME", "my-redis-wrapper");await redis.clientSetInfo("LIB-VER", "3.2.1");// Now this information will appear in CLIENT LIST output

Use Cases

  • Debugging: Identify which client library version is being used
  • Monitoring: Track different client libraries connecting to Redis
  • Analytics: Understand client library distribution across connections
  • Support: Quickly identify client versions when troubleshooting issues

Viewing Client Information

After setting client info, you can view it using the CLIENT LIST command:

// Set client informationawait redis.clientSetInfo("LIB-NAME", "redis-js");await redis.clientSetInfo("LIB-VER", "1.0.0");// View all clients (if you have access to CLIENT LIST)// The output will include lib-name and lib-ver fields

Best Practices

  1. Set on Connection: Set client info immediately after establishing a connection
  2. Include Version: Always set both library name and version
  3. Use Descriptive Names: Make library names easily identifiable
  4. Version Format: Use semantic versioning (e.g., "1.2.3")
  5. Include Context: Add wrapper or framework info if applicable

This command is available in Redis 7.2.0 and later. The attribute names are case-insensitive and will be normalized to uppercase.

Loading search…