Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wandenberg/redis_nginx_adapter
Adapter to use hiredis with async connections inside a nginx module
https://github.com/wandenberg/redis_nginx_adapter
Last synced: 3 months ago
JSON representation
Adapter to use hiredis with async connections inside a nginx module
- Host: GitHub
- URL: https://github.com/wandenberg/redis_nginx_adapter
- Owner: wandenberg
- License: mit
- Created: 2014-03-10T19:52:18.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-18T22:51:39.000Z (over 5 years ago)
- Last Synced: 2024-01-18T11:46:50.373Z (5 months ago)
- Language: C
- Size: 318 KB
- Stars: 28
- Watchers: 9
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: COPYING
Lists
- awesome-stars - redis_nginx_adapter - Adapter to use hiredis with async connections inside a nginx module (Shell)
README
redis_nginx_adapter
===================An adapter to use the events structure from Nginx on communication with redis, using redis asynchronous context.
It requires [hiredis](https://github.com/redis/hiredis) >= 0.11.0, and Nginx headers.Installation
------------* get Nginx source and configure it with ./configure
* get hiredis source, configure and install it
* configure redis_nginx_adapter pointing to nginx source dir and hiredis like
./configure --with-nginx-dir=../nginx-1.7.1 --with-hiredis-dir=/opt --with-openssl-dir=/usr/local/opt/openssl
make
make installBasic usage
-----------### Without authentication
```
redis_nginx_init();
redisAsyncContext *redis_server = NULL;
if (redis_nginx_open_context((const char *) "localhost", 6379, 0, NULL, &redis_server) != NULL) {
redisAsyncCommand(redis_server, NULL, NULL, "SET %b %d-%d", r->uri.data, r->uri.len, r->headers_out.status, r->headers_out.content_length_n);
}
redis_nginx_close_context(&redis_server);
```### With authentication
```
redis_nginx_init();
redisAsyncContext *redis_server = NULL;
if (redis_nginx_open_context((const char *) "localhost", 6379, 0, (const char*) "password", &redis_server) != NULL) {
redisAsyncCommand(redis_server, NULL, NULL, "SET %b %d-%d", r->uri.data, r->uri.len, r->headers_out.status, r->headers_out.content_length_n);
}
redis_nginx_close_context(&redis_server);
```Example
-------At the `example/module` folder there is a very basic Nginx module that uses the library.
And a Dockerfile that demonstrate how to build and run it.