RedisX v0.9
A simple, light-weight Redis database client
|
Functions | |
int | redisxLoadScript (Redis *redis, const char *script, char **sha1) |
RESP * | redisxRunScript (Redis *redis, const char *sha1, const char **keys, const char **params) |
int | redisxRunScriptAsync (RedisClient *cl, const char *sha1, const char **keys, const char **params) |
Supporting functions for loading and LUA scripts on a Redis server.
int redisxLoadScript | ( | Redis * | redis, |
const char * | script, | ||
char ** | sha1 | ||
) |
Loads a LUA script into Redis, returning its SHA1 hash to use as it's call ID.
[in] | redis | Pointer to a Redis instance. |
[in] | script | String containing the full LUA script. |
[out] | sha1 | Buffer into which SHA1 key returned by Redis to use as call ID. (It must be at least 41 bytes, and will be string terminated). By default it will return an empty string. |
References redisxCheckDestroyRESP(), redisxDestroyRESP(), redisxRequest(), RESP_BULK_STRING, RESP::value, x_error(), X_NULL, X_SUCCESS, and x_trace().
RESP * redisxRunScript | ( | Redis * | redis, |
const char * | sha1, | ||
const char ** | keys, | ||
const char ** | params | ||
) |
Runs a LUA script that has been loaded into the Redis database, returning the response received, or NULL if there was an error.
redis | The Redis instance |
sha1 | The SHA1 sum of the script that was previously loaded into the Redis DB. |
keys | A NULL-terminated array of Redis keywords, or NULL if the script does not take any keyword argument. |
params | A NULL-terminated array of additional parameters to pass onto the script, or NULL if the script does not take any parameters. |
References Redis::interactive, redisxLockConnected(), redisxReadReplyAsync(), redisxRunScriptAsync(), redisxUnlockClient(), X_SUCCESS, and x_trace_null().
int redisxRunScriptAsync | ( | RedisClient * | cl, |
const char * | sha1, | ||
const char ** | keys, | ||
const char ** | params | ||
) |
Send a request to runs a LUA script that has been loaded into the Redis database. This function should be called with the connected client's mutex locked. The call returns as soon as the request has been sent, without waiting for a response to come back.
cl | The Redis client channel on which to send the request to run the script |
sha1 | The SHA1 sum of the script that was previously loaded into the Redis DB. |
keys | A NULL-terminated array of Redis keywords, or NULL if the script does not take any keyword argument. |
params | A NULL-terminated array of additional parameters to pass onto the script, or NULL if the script does not take any parameters. |
redis
or sha1
parameters are NULL, or else an error code (<0) from redisxSendArrayRequestAsync().References redisxSendArrayRequestAsync(), x_error(), X_NULL, and X_SUCCESS.