Skip to content

Commit

Permalink
README edits and site update
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 5, 2024
1 parent 98d8e73 commit 3789bce
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,17 @@ the default 6379), and the database authentication (if any):
Redis *redis = ...

// (optional) configure a non-standard port number
redisxSetPort(&redis, 7089);
redisxSetPort(redis, 7089);

// (optional) Configure the database user (since Redis 6.0, using ACL)
redisxSetUser(&redis, "johndoe");
redisxSetUser(redis, "johndoe");

// (optional) Configure the database password...
redisxSetPassword(&redis, mySecretPasswordString);
redisxSetPassword(redis, mySecretPasswordString);
```
You might also tweak the send/receive buffer sizes to use for clients, if you find the socket defaults sub-optimal for
your application:
your application (note, that this setting is common to all `Redis` instances managed by the library):
```c
// (optional) Set the TCP send/rcv buffer sizes to use if not default values.
Expand All @@ -220,7 +220,7 @@ Optionally, you can select the database index to use now (or later, after connec
```c
Redis *redis = ...

// Select the database index 2
// (optional) Select the database index 2
redisxSelectDB(redis, 2);
```
Expand All @@ -234,13 +234,15 @@ subscription client when there are active subscriptions.
Once configured, you can connect to the server as:
```c
Redis *redis = ...
// Connect to Redis, including a 2nd dedicated client for pipelined requests
int status = redisxConnect(&redis, TRUE);
int status = redisxConnect(redis, TRUE);
if (status != X_SUCCESS) {
// Abort: we could not connect for some reason...
...
// Clean up...
redisxDestroy(&redis);
redisxDestroy(redis);
...
}
```
Expand All @@ -259,6 +261,17 @@ When you are done with a specific Redis server, you should disconnect from it:
redisxDisconnect(redis);
```
And then to free up all resources used by the `Redis` instance, you might also call
```c
// Destroy the Redis instance and free up resources
redisxDestroy(redis);
// Set the destroyed Redis instance pointer to NULL, as best practice.
redis = NULL;
```


<a name="connection-hooks"></a>
### Connection hooks

Expand Down

0 comments on commit 3789bce

Please sign in to comment.