Here is an example:local redis = require "resty.redis" local red = redis:new() red:set_timeouts(1000, 1000, 1000) -- 1 sec local ok, err = red:connect("127.0.0.1", 6379) if not ok then ngx.say("failed to connect: ", err) return end local res, err = red:auth("foobared"...
down_socket(c->conn.connection->fd, SHUT_RDWR) == -1) { ngx_connection_error(c->conn.connection, ngx_socket_errno, ngx_shutdown_socket_n " failed"); ngx_http_auth_ldap_close_connection(c); return -1; } } return 0; } static int ngx_http_auth_ldap_sb_ctrl(Sockbuf_IO_Desc *s...
见ngx_event_accept, 连接上游服务区的时候在ngx_http_upstream_connect创建structsockaddr *sockaddr;//连接客户端的sockaddr结构体 客户端的,本端的为下面的local_sockaddr 赋值见ngx_event_acceptsocklen_t socklen;//sockaddr结构体的长度//赋值见ngx_event_acceptngx_str_t addr_text;//连接...
6379)ifnotokthenngx.say("failed to connect: ", err)returnendlocalok, err = red:multi()ifnotokthenngx.say("failed to run multi: ", err)returnendngx.say("multi ans: ", cjson.encode(ok))localans, err = red:set("a","abc")ifnotansthenngx.say("failed to run sort: ", err)retu...
//127.0.0.1:8090 16 threads and 100 connections Thread Stats Avg Stdev Max +/- Stdev Latency 132.92ms 158.49ms 1.98s 86.67% Req/Sec 54.38 56.83 670.00 94.88% 22603 requests in 30.08s, 49.40MB read Socket errors: connect 0, read 0, write 0, timeout 112 Requests/sec: 751.53 Transfer/...
socketio-plugin: WebSocketConnected event now carry socketId (b18c564) socketio-plugin: WebSocketConnected event now carry socketId (b3b0f93) viewport: added new Viewport module (d2f1a2e) webapp-e2e: switching from testcafe to cypress for e2e tests (cfecbf8) context-menu example (c215c65)...
Load the modules in the nginx configuration @/etc/nginx/nginx.confand runnginx -t Here is an example full run of the commands I did above [root@localhost~]#cd /usr/src[root@localhost src]#git clone https://github.com/google/ngx_brotli.gitCloning into'ngx_brotli'... remote: Enumerating...
Example local mongo = require "resty.mongol" conn = mongo:new() conn:set_timeout(1000) ok, err = conn:connect() if not ok then ngx.say("connect failed: "..err) end local db = conn:new_db_handle ( "test" ) col = db:get_col("test") ...
This library supports theRedis transactions. Here is an example: localcjson=require"cjson"localredis=require"resty.redis"localred=redis:new()red:set_timeout(1000)--1 seclocalok,err=red:connect("127.0.0.1",6379)ifnotokthenngx.say("failed to connect:",err)returnendlocalok,err=red:multi()...
Here is an example:local redis = require "resty.redis" local red = redis:new() red:set_timeout(1000) -- 1 sec local ok, err = red:connect("127.0.0.1", 6379) if not ok then ngx.say("failed to connect: ", err) return end local res, err = red:auth("foobared") if not res...