![]() |
RedisX v1.1
A simple, light-weight Redis database client
|
Macros | |
| #define | sockopt_t void * |
| pointer type for setsockopt() pointer arg | |
Functions | |
| void | rCloseClientAsync (RedisClient *cl) |
| int | rConnectAsync (Redis *redis, XBoolean usePipeline) |
| void | rDisconnectAsync (Redis *redis) |
| xthread_rtn_type | RedisPipelineListener (xthread_arg_type pRedis) |
| int | redisxConnect (Redis *redis, XBoolean usePipeline) |
| void | redisxDestroy (Redis *redis) |
| void | redisxDisconnect (Redis *redis) |
| Redis * | redisxInit (const char *server) |
| XBoolean | redisxIsConnected (Redis *redis) |
| int | redisxReconnect (Redis *redis, XBoolean usePipeline) |
| int | redisxSetHostname (Redis *redis, const char *host) |
| int | redisxSetPort (Redis *redis, int port) |
| int | redisxSetSocketTimeout (Redis *redis, int millis) |
| int | redisxSetTcpBuf (Redis *redis, int size) |
| int | rSetServerAsync (Redis *redis, const char *desc, const char *hostname, int port) |
Network layer management functions for the RedisX library.
Notes:
| void rCloseClientAsync | ( | RedisClient * | cl | ) |
Closes the Redis client on the specified communication channel. This call assumes that the caller has an exlusive lock on the client.
| cl | Pointer to the Redis client instance. |
References rCloseClientAsync().
| int rConnectAsync | ( | Redis * | redis, |
| XBoolean | usePipeline ) |
Same as rConnectClient() but called with the client's mutex already locked.
| redis | Pointer to a Redis instance. |
| usePipeline | TRUE (non-zero) if a pipeline client should be connected also, or FALSE to create an interactive connection only. |
References Redis::id, Redis::interactive, Redis::pipeline, rConnectAsync(), REDISX_INTERACTIVE_CHANNEL, REDISX_PIPELINE_CHANNEL, redisxErrorDescription(), and redisxIsConnected().
| void rDisconnectAsync | ( | Redis * | redis | ) |
Same as redisxDisconnect() except without the exclusive configuration locking of the Redis instance.
| redis | Pointer to a Redis instance. |
References Redis::interactive, Redis::pipeline, rDisconnectAsync(), and Redis::subscription.
| xthread_rtn_type RedisPipelineListener | ( | xthread_arg_type | pRedis | ) |
The listener function that processes pipelined responses in the background. It is started when Redis is connected with the pipeline enabled.
| pRedis | Pointer to a Redis instance. |
References RESP::n, Redis::pipeline, RedisPipelineListener(), redisxCheckValid(), redisxDestroyRESP(), redisxReadReplyAsync(), RESP_SIMPLE_STRING, and RESP::type.
| int redisxConnect | ( | Redis * | redis, |
| XBoolean | usePipeline ) |
Connects to a Redis server.
| redis | Pointer to a Redis instance. |
| usePipeline | TRUE (non-zero) if Redis should be connected with a pipeline client also, or FALSE (0) if only the interactive client is needed. |
References rConnectAsync(), and redisxConnect().
| void redisxDestroy | ( | Redis * | redis | ) |
Destroys a Redis intance, disconnecting any clients that may be connected, and freeing all resources used by that Redis instance.
| redis | Pointer to a Redis instance. |
References Redis::id, REDISX_CHANNELS, redisxClearSubscribers(), redisxDestroy(), redisxDestroyRESP(), redisxDisconnect(), and redisxIsConnected().
| void redisxDisconnect | ( | Redis * | redis | ) |
Disconnect all clients from the Redis server.
| redis | Pointer to a Redis instance. |
References rDisconnectAsync(), redisxCheckValid(), and redisxDisconnect().
| Redis * redisxInit | ( | const char * | server | ) |
Initializes the Redis client library, and sets the hostname or IP address for the Redis server.
| server | Server host name or numeric IP address, e.g. "127.0.0.1". The string will be copied, not referenced, for the internal configuration, such that the string passed may be destroyed freely after the call. |
References Redis::interactive, Redis::pipeline, REDISX_CHANNELS, REDISX_DEFAULT_TIMEOUT_MILLIS, REDISX_INTERACTIVE_CHANNEL, REDISX_PIPELINE_CHANNEL, REDISX_RESP2, REDISX_SUBSCRIPTION_CHANNEL, REDISX_TCP_BUF_SIZE, redisxInit(), rSetServerAsync(), and Redis::subscription.
| XBoolean redisxIsConnected | ( | Redis * | redis | ) |
Checks if a Redis instance is connected.
| redis | Pointer to a Redis instance. |
References Redis::interactive, redisxCheckValid(), and redisxIsConnected().
| int redisxReconnect | ( | Redis * | redis, |
| XBoolean | usePipeline ) |
Disconnects from Redis, and then connects again...
| redis | Pointer to a Redis instance. |
| usePipeline | Whether to reconnect in pipelined mode. |
or else an error (<0) as would be returned by redisxConnect().
References redisxReconnect().
| int redisxSetHostname | ( | Redis * | redis, |
| const char * | host ) |
Changes the host name for the Redis server, prior to calling redisxConnect().
| redis | Pointer to a Redis instance. |
| host | New host name or IP address to use. |
References redisxIsConnected(), redisxSetHostname(), and rSetServerAsync().
| int redisxSetPort | ( | Redis * | redis, |
| int | port ) |
Sets a non-standard TCP port number to use for the Redis server, prior to calling redisxConnect().
| redis | Pointer to a Redis instance. |
| port | The TCP port number to use. |
References redisxIsConnected(), and redisxSetPort().
| int redisxSetSocketTimeout | ( | Redis * | redis, |
| int | millis ) |
Sets a socket timeout for future client connections on a Redis instance. Effectively this is a timeout for send() only. The timeout for interatvice replies is controlled separately via redisxSetReplyTimoeut().
If not set (or set to zero or a negative value), then the timeout will not be configured for sockets, and the system default timeout values will apply.
| redis | The Redis instance |
| millis | [ms] The desired socket read/write timeout, or <0 for socket default. |
References REDISX_DEFAULT_TIMEOUT_MILLIS, and redisxSetSocketTimeout().
| int redisxSetTcpBuf | ( | Redis * | redis, |
| int | size ) |
Set the size of the TCP/IP buffers (send and receive) for future client connections.
| redis | Pointer to a Redis instance. |
| size | (bytes) requested buffer size, or <= 0 to use default value |
References redisxSetTcpBuf().
| int rSetServerAsync | ( | Redis * | redis, |
| const char * | desc, | ||
| const char * | hostname, | ||
| int | port ) |
Configures a new server by name or IP address and port number for a given Redis instance
| redis | A Redis instance |
| desc | The type of server, e.g. "master", "replica", "sentinel-18" |
| hostname | The new host name or IP address |
| port | The new port number, or <=0 to use the default Redis port. |
References Redis::id, REDISX_TCP_PORT, and rSetServerAsync().