From 61c40e8cc426f89c4e123f3ac7d6a1ce135fa872 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 5 Dec 2024 10:34:09 +0000 Subject: [PATCH] [automated site update] --- apidoc/html/index.html | 28 +++++++++++++++------------- apidoc/html/redisx-client_8c.html | 28 ++++++++++++++-------------- apidoc/html/redisx_8h.html | 28 ++++++++++++++-------------- apidoc/man/man3/redisx-client.c.3 | 28 ++++++++++++++-------------- apidoc/man/man3/redisx.h.3 | 28 ++++++++++++++-------------- doc/README.md | 14 ++++++++------ 6 files changed, 79 insertions(+), 75 deletions(-) diff --git a/apidoc/html/index.html b/apidoc/html/index.html index 04e0017..0287e76 100644 --- a/apidoc/html/index.html +++ b/apidoc/html/index.html @@ -220,16 +220,16 @@

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);
int redisxSetPassword(Redis *redis, const char *passwd)
Definition redisx.c:141
int redisxSetUser(Redis *redis, const char *username)
Definition redisx.c:113
-

You might also tweak the send/receive buffer sizes to use for clients, if you find the socket defaults sub-optimal for your application:

+

You might also tweak the send/receive buffer sizes to use for clients, if you find the socket defaults sub-optimal for your application (note, that this setting is common to all Redis instances managed by the library):

// (optional) Set the TCP send/rcv buffer sizes to use if not default values.
// This setting applies to all new connections after...
@@ -244,13 +244,15 @@

Connecting

Once configured, you can connect to the server as:

-
// Connect to Redis, including a 2nd dedicated client for pipelined requests
-
int status = redisxConnect(&redis, TRUE);
+
Redis *redis = ...
+
+
// Connect to Redis, including a 2nd dedicated client for pipelined requests
+
int status = redisxConnect(redis, TRUE);
if (status != X_SUCCESS) {
// Abort: we could not connect for some reason...
...
// Clean up...
-
redisxDestroy(&redis);
+
redisxDestroy(redis);
...
}
void redisxDestroy(Redis *redis)
Definition redisx-net.c:680
@@ -567,10 +569,10 @@

// Inspect the RESP, etc...
...
RedisClient * redisxGetLockedConnectedClient(Redis *redis, enum redisx_channel channel)
Definition redisx-client.c:309
-
int redisxStartBlockAsync(RedisClient *cl)
Definition redisx-client.c:444
-
RESP * redisxExecBlockAsync(RedisClient *cl)
Definition redisx-client.c:492
-
int redisxUnlockClient(RedisClient *cl)
Definition redisx-client.c:386
-
int redisxSendRequestAsync(RedisClient *cl, const char *command, const char *arg1, const char *arg2, const char *arg3)
Definition redisx-client.c:538
+
int redisxStartBlockAsync(RedisClient *cl)
Definition redisx-client.c:452
+
RESP * redisxExecBlockAsync(RedisClient *cl)
Definition redisx-client.c:503
+
int redisxUnlockClient(RedisClient *cl)
Definition redisx-client.c:391
+
int redisxSendRequestAsync(RedisClient *cl, const char *command, const char *arg1, const char *arg2, const char *arg3)
Definition redisx-client.c:554
@ REDISX_INTERACTIVE_CHANNEL
Redis channel number for interactive queries.
Definition redisx.h:108
Structure that represents a single Redis client connection instance.
Definition redisx.h:145

If at any point things don't go according to plan in the middle of the block, you can call redisAbortBlockAsync() to abort and discard all prior commands submitted in the execution block already. It is important to remember that every time you call redisxStartBlockAsync(), you must call either redisxExecBlockAsync() to execute it or else redisxAbortBlockAsync() to discard it. Failure to do so, will effectively end you up with a hung Redis client.

@@ -654,7 +656,7 @@

}
...
-
RESP * redisxReadReplyAsync(RedisClient *cl)
Definition redisx-client.c:659
+
RESP * redisxReadReplyAsync(RedisClient *cl)
Definition redisx-client.c:680
int redisxCheckRESP(const RESP *resp, char expectedType, int expectedSize)
Definition redisx.c:419

For the best performance, you may want to leave the processing of the replies until after you unlock the client. I.e., you only block other threads from accessing the client while you send off the requests and collect the corresponding responses. You can then analyze the responses at your leisure outside of the mutexed section.

In some cases you may be OK with just firing off some Redis commands, without necessarily caring about responses. Rather than ignoring the replies with redisxIgnoreReplyAsync() you might call redisxSkipReplyAsync() instead before redisxSendRequestAsync() to instruct Redis to not even bother about sending a response to your request (it saves time and network bandwidth!):

@@ -670,7 +672,7 @@

// Ooops, the request did not go through...
...
}
-
int redisxSkipReplyAsync(RedisClient *cl)
Definition redisx-client.c:413
+
int redisxSkipReplyAsync(RedisClient *cl)
Definition redisx-client.c:419

Of course you can build up arbitrarily complex set of queries and deal with a set of responses in different ways. Do what works best for your application.

diff --git a/apidoc/html/redisx-client_8c.html b/apidoc/html/redisx-client_8c.html index 06ebb0d..af88dce 100644 --- a/apidoc/html/redisx-client_8c.html +++ b/apidoc/html/redisx-client_8c.html @@ -188,10 +188,10 @@

Returns
X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected ot the client or if send() failed.
+
Returns
X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or X_NO_SERVICE if not connected ot the client or if send() failed, or X_NO_INIT if the client was not initialized.
See also
redisxStartBlockAsync()
-

References redisxIgnoreReplyAsync(), TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References redisxIgnoreReplyAsync(), TRUE, x_error(), X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -359,12 +359,12 @@

Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL.
+
Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized.
See also
redisxLockConnected()
redisxUnlockClient()
-

References x_error(), X_FAILURE, X_NULL, and X_SUCCESS.

+

References x_error(), X_FAILURE, X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -390,14 +390,14 @@

Returns
X_SUCCESS (0) if an excusive lock to the channel has been granted. X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL REDIS_INVALID_CHANNEL if the channel is not enabled/connected.
+
Returns
X_SUCCESS (0) if an excusive lock to the channel has been granted, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized.
See also
redisxLockClient()
redisxUnlockClient()
redisxGetLockedConnectedClient()
-

References redisxLockClient(), redisxUnlockClient(), x_error(), X_NO_SERVICE, and X_SUCCESS.

+

References redisxLockClient(), redisxUnlockClient(), x_error(), X_NO_INIT, X_NO_SERVICE, and X_SUCCESS.

@@ -504,9 +504,9 @@

Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the client or if send() failed.
+
Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or X_NO_SERVICE if not connected to the client or if send() failed, or X_NO_INIT if the client was not initialized.
-

References FALSE, REDISX_CMDBUF_SIZE, TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References FALSE, REDISX_CMDBUF_SIZE, TRUE, x_error(), X_NO_INIT, X_NO_SERVICE, X_NULL, and X_SUCCESS.

@@ -593,9 +593,9 @@

Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the Redis server on the requested channel, or if send() failed.
+
Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the Redis server on the requested channel, or if send() failed, or else X_NO_INIT if the client was not initialized.
-

References TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References TRUE, x_error(), X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -622,12 +622,12 @@

Returns
X_SUCCESS (0) if successful, or X_NULL if the Redis client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed.
+
Returns
X_SUCCESS (0) if successful, or X_NULL if the Redis client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed, or X_NO_INIT if the client was not initialized.
See also
redisxExecBlockAsync()
redisxAbortBlockAsync()
-

References TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References TRUE, x_error(), X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -653,12 +653,12 @@

Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL
+
Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized.
See also
redisxLockClient()
redisxLockConnected()
-

References x_error(), X_FAILURE, X_NULL, and X_SUCCESS.

+

References x_error(), X_FAILURE, X_NO_INIT, X_NULL, and X_SUCCESS.

diff --git a/apidoc/html/redisx_8h.html b/apidoc/html/redisx_8h.html index 7f23566..d8aa0da 100644 --- a/apidoc/html/redisx_8h.html +++ b/apidoc/html/redisx_8h.html @@ -530,10 +530,10 @@

Returns
X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected ot the client or if send() failed.
+
Returns
X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or X_NO_SERVICE if not connected ot the client or if send() failed, or X_NO_INIT if the client was not initialized.
See also
redisxStartBlockAsync()
-

References redisxIgnoreReplyAsync(), TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References redisxIgnoreReplyAsync(), TRUE, x_error(), X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -1841,12 +1841,12 @@

Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL.
+
Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized.
See also
redisxLockConnected()
redisxUnlockClient()
-

References x_error(), X_FAILURE, X_NULL, and X_SUCCESS.

+

References x_error(), X_FAILURE, X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -1872,14 +1872,14 @@

Returns
X_SUCCESS (0) if an excusive lock to the channel has been granted. X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL REDIS_INVALID_CHANNEL if the channel is not enabled/connected.
+
Returns
X_SUCCESS (0) if an excusive lock to the channel has been granted, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized.
See also
redisxLockClient()
redisxUnlockClient()
redisxGetLockedConnectedClient()
-

References redisxLockClient(), redisxUnlockClient(), x_error(), X_NO_SERVICE, and X_SUCCESS.

+

References redisxLockClient(), redisxUnlockClient(), x_error(), X_NO_INIT, X_NO_SERVICE, and X_SUCCESS.

@@ -2691,9 +2691,9 @@

Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the client or if send() failed.
+
Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or X_NO_SERVICE if not connected to the client or if send() failed, or X_NO_INIT if the client was not initialized.
-

References FALSE, REDISX_CMDBUF_SIZE, TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References FALSE, REDISX_CMDBUF_SIZE, TRUE, x_error(), X_NO_INIT, X_NO_SERVICE, X_NULL, and X_SUCCESS.

@@ -3195,9 +3195,9 @@

Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the Redis server on the requested channel, or if send() failed.
+
Returns
X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the Redis server on the requested channel, or if send() failed, or else X_NO_INIT if the client was not initialized.
-

References TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References TRUE, x_error(), X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -3224,12 +3224,12 @@

Returns
X_SUCCESS (0) if successful, or X_NULL if the Redis client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed.
+
Returns
X_SUCCESS (0) if successful, or X_NULL if the Redis client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed, or X_NO_INIT if the client was not initialized.
See also
redisxExecBlockAsync()
redisxAbortBlockAsync()
-

References TRUE, x_error(), X_NULL, and X_SUCCESS.

+

References TRUE, x_error(), X_NO_INIT, X_NULL, and X_SUCCESS.

@@ -3303,12 +3303,12 @@

Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL
+
Returns
X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized.
See also
redisxLockClient()
redisxLockConnected()
-

References x_error(), X_FAILURE, X_NULL, and X_SUCCESS.

+

References x_error(), X_FAILURE, X_NO_INIT, X_NULL, and X_SUCCESS.

diff --git a/apidoc/man/man3/redisx-client.c.3 b/apidoc/man/man3/redisx-client.c.3 index 103fec8..997061a 100644 --- a/apidoc/man/man3/redisx-client.c.3 +++ b/apidoc/man/man3/redisx-client.c.3 @@ -91,7 +91,7 @@ Abort an atomic transaction block\&. It sends \fCDISCARD\fP\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected ot the client or if send() failed\&. +X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or X_NO_SERVICE if not connected ot the client or if send() failed, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -101,7 +101,7 @@ X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or else X_NO_SERVI .PP .PP -References \fBredisxIgnoreReplyAsync()\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBredisxIgnoreReplyAsync()\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "\fBRESP\fP * redisxExecBlockAsync (\fBRedisClient\fP * cl)" Finish and execute an atomic transaction block\&. It sends \fCEXEC\fP, skips through all \fCOK\fP and \fCQUEUED\fP acknowledgements, and returns the reply to the transaction block itself\&. .PP @@ -196,7 +196,7 @@ Get exclusive write access to the specified \fBRedis\fP channel\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL\&. +X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -208,7 +208,7 @@ X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAIL .PP .PP -References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxLockConnected (\fBRedisClient\fP * cl)" Lock a channel, but only if it has been enabled for communication\&. .PP @@ -219,7 +219,7 @@ Lock a channel, but only if it has been enabled for communication\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) if an excusive lock to the channel has been granted\&. X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL REDIS_INVALID_CHANNEL if the channel is not enabled/connected\&. +X_SUCCESS (0) if an excusive lock to the channel has been granted, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -233,7 +233,7 @@ X_SUCCESS (0) if an excusive lock to the channel has been granted\&. X_FAILURE i .PP .PP -References \fBredisxLockClient()\fP, \fBredisxUnlockClient()\fP, \fBx_error()\fP, \fBX_NO_SERVICE\fP, and \fBX_SUCCESS\fP\&. +References \fBredisxLockClient()\fP, \fBredisxUnlockClient()\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NO_SERVICE\fP, and \fBX_SUCCESS\fP\&. .SS "\fBRESP\fP * redisxReadReplyAsync (\fBRedisClient\fP * cl)" Reads a response from \fBRedis\fP and returns it\&. .PP @@ -282,12 +282,12 @@ Send a \fBRedis\fP request with an arbitrary number of arguments\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the client or if send() failed\&. +X_SUCCESS (0) on success or X_NULL if the client is NULL, or X_NO_SERVICE if not connected to the client or if send() failed, or X_NO_INIT if the client was not initialized\&. .RE .PP .PP -References \fBFALSE\fP, \fBREDISX_CMDBUF_SIZE\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBFALSE\fP, \fBREDISX_CMDBUF_SIZE\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NO_SERVICE\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxSendRequestAsync (\fBRedisClient\fP * cl, const char * command, const char * arg1, const char * arg2, const char * arg3)" Send a command (with up to 3 arguments) to the \fBRedis\fP server\&. The caller must have an exclusive lock on the client for this version\&. The arguments supplied will be used up to the first non-NULL value\&. .PP @@ -324,12 +324,12 @@ Sends \fCCLIENT REPLY SKIP\fP .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the \fBRedis\fP server on the requested channel, or if send() failed\&. +X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the \fBRedis\fP server on the requested channel, or if send() failed, or else X_NO_INIT if the client was not initialized\&. .RE .PP .PP -References \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxStartBlockAsync (\fBRedisClient\fP * cl)" Starts an atomic \fBRedis\fP transaction block, by sending \fCMULTI\fP on the specified client connection\&. \fBRedis\fP transaction blocks behave just like scripts (in fact they are effectively improptu scripts themselves)\&. As such the rules of \fBRedis\fP scripting apply, such as you cannot call LUA from within a transaction block (which is a real pity\&.\&.\&.) .PP @@ -342,7 +342,7 @@ Once you start a transaction block you may ignore all acknowledgedments such as .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) if successful, or X_NULL if the \fBRedis\fP client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed\&. +X_SUCCESS (0) if successful, or X_NULL if the \fBRedis\fP client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -354,7 +354,7 @@ X_SUCCESS (0) if successful, or X_NULL if the \fBRedis\fP client is NULL, or X_N .PP .PP -References \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxUnlockClient (\fBRedisClient\fP * cl)" Relinquish exclusive write access to the specified \fBRedis\fP channel .PP @@ -365,7 +365,7 @@ Relinquish exclusive write access to the specified \fBRedis\fP channel .PP \fBReturns\fP .RS 4 -X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL +X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -377,7 +377,7 @@ X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAIL .PP .PP -References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SH "Author" .PP Generated automatically by Doxygen for RedisX from the source code\&. diff --git a/apidoc/man/man3/redisx.h.3 b/apidoc/man/man3/redisx.h.3 index 31c6b57..34adc75 100644 --- a/apidoc/man/man3/redisx.h.3 +++ b/apidoc/man/man3/redisx.h.3 @@ -444,7 +444,7 @@ Abort an atomic transaction block\&. It sends \fCDISCARD\fP\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected ot the client or if send() failed\&. +X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or X_NO_SERVICE if not connected ot the client or if send() failed, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -454,7 +454,7 @@ X_SUCCESS (0) if successful, or X_NULL if the client is NULL, or else X_NO_SERVI .PP .PP -References \fBredisxIgnoreReplyAsync()\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBredisxIgnoreReplyAsync()\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxAddConnectHook (\fBRedis\fP * redis, void(*)(\fBRedis\fP *) setupCall)" Adds a connect call hook, provided it is not already part of the setup routine\&. .PP @@ -1146,7 +1146,7 @@ Get exclusive write access to the specified \fBRedis\fP channel\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL\&. +X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -1158,7 +1158,7 @@ X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAIL .PP .PP -References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxLockConnected (\fBRedisClient\fP * cl)" Lock a channel, but only if it has been enabled for communication\&. .PP @@ -1169,7 +1169,7 @@ Lock a channel, but only if it has been enabled for communication\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) if an excusive lock to the channel has been granted\&. X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL REDIS_INVALID_CHANNEL if the channel is not enabled/connected\&. +X_SUCCESS (0) if an excusive lock to the channel has been granted, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -1183,7 +1183,7 @@ X_SUCCESS (0) if an excusive lock to the channel has been granted\&. X_FAILURE i .PP .PP -References \fBredisxLockClient()\fP, \fBredisxUnlockClient()\fP, \fBx_error()\fP, \fBX_NO_SERVICE\fP, and \fBX_SUCCESS\fP\&. +References \fBredisxLockClient()\fP, \fBredisxUnlockClient()\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NO_SERVICE\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxMultiSet (\fBRedis\fP * redis, const char * table, const \fBRedisEntry\fP * entries, int n, \fBboolean\fP confirm)" Sets multiple key/value pairs in a given hash table\&. .PP @@ -1597,12 +1597,12 @@ Send a \fBRedis\fP request with an arbitrary number of arguments\&. .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the client or if send() failed\&. +X_SUCCESS (0) on success or X_NULL if the client is NULL, or X_NO_SERVICE if not connected to the client or if send() failed, or X_NO_INIT if the client was not initialized\&. .RE .PP .PP -References \fBFALSE\fP, \fBREDISX_CMDBUF_SIZE\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBFALSE\fP, \fBREDISX_CMDBUF_SIZE\fP, \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NO_SERVICE\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxSendRequestAsync (\fBRedisClient\fP * cl, const char * command, const char * arg1, const char * arg2, const char * arg3)" Send a command (with up to 3 arguments) to the \fBRedis\fP server\&. The caller must have an exclusive lock on the client for this version\&. The arguments supplied will be used up to the first non-NULL value\&. .PP @@ -1836,12 +1836,12 @@ Sends \fCCLIENT REPLY SKIP\fP .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the \fBRedis\fP server on the requested channel, or if send() failed\&. +X_SUCCESS (0) on success or X_NULL if the client is NULL, or else X_NO_SERVICE if not connected to the \fBRedis\fP server on the requested channel, or if send() failed, or else X_NO_INIT if the client was not initialized\&. .RE .PP .PP -References \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxStartBlockAsync (\fBRedisClient\fP * cl)" Starts an atomic \fBRedis\fP transaction block, by sending \fCMULTI\fP on the specified client connection\&. \fBRedis\fP transaction blocks behave just like scripts (in fact they are effectively improptu scripts themselves)\&. As such the rules of \fBRedis\fP scripting apply, such as you cannot call LUA from within a transaction block (which is a real pity\&.\&.\&.) .PP @@ -1854,7 +1854,7 @@ Once you start a transaction block you may ignore all acknowledgedments such as .PP \fBReturns\fP .RS 4 -X_SUCCESS (0) if successful, or X_NULL if the \fBRedis\fP client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed\&. +X_SUCCESS (0) if successful, or X_NULL if the \fBRedis\fP client is NULL, or X_NO_SERVICE if not connected to the client server or if send() failed, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -1866,7 +1866,7 @@ X_SUCCESS (0) if successful, or X_NULL if the \fBRedis\fP client is NULL, or X_N .PP .PP -References \fBTRUE\fP, \fBx_error()\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBTRUE\fP, \fBx_error()\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxSubscribe (\fBRedis\fP * redis, const char * pattern)" Subscribe to a specific \fBRedis\fP channel\&. The call will also start the subscription listener thread to processing incoming subscription messages\&. Subscribing only enabled the delivery of the messages to this client without any actions on these messages\&. In order to process the messages for your subscriptons, you will also want to call \fBredisxAddSubscriber()\fP to add your custom processor function(s)\&. .PP @@ -1908,7 +1908,7 @@ Relinquish exclusive write access to the specified \fBRedis\fP channel .PP \fBReturns\fP .RS 4 -X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAILURE if pthread_mutex_lock() returned an error X_NULL if the client is NULL +X_SUCCESS if the exclusive lock for the channel was successfully obtained, or X_FAILURE if pthread_mutex_lock() returned an error, or X_NULL if the client is NULL, or X_NO_INIT if the client was not initialized\&. .RE .PP \fBSee also\fP @@ -1920,7 +1920,7 @@ X_SUCCESS if the exclusive lock for the channel was successfully obtained X_FAIL .PP .PP -References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. +References \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_NO_INIT\fP, \fBX_NULL\fP, and \fBX_SUCCESS\fP\&. .SS "int redisxUnsubscribe (\fBRedis\fP * redis, const char * pattern)" Unsubscribe from one or all \fBRedis\fP PUB/SUB channel(s)\&. If there are no active subscriptions when \fBRedis\fP confirms the unsubscrive command, the subscription listener thread will also conclude automatically\&. Unsubscribing will stop delivery of mesasages for the affected channels but any associated processing callbacks remain registered, until redisxRemovesubscribers() is called to deactive them as appropriate\&. .PP diff --git a/doc/README.md b/doc/README.md index 17a63d8..f6f0cf7 100644 --- a/doc/README.md +++ b/doc/README.md @@ -179,17 +179,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. @@ -217,13 +217,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); ... } ```