• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/resty/H09-Oct-2020-677490

t/H09-Oct-2020-3,3132,604

.gitattributesH A D09-Oct-202027 21

.gitignoreH A D09-Oct-202048 98

.luacheckrcH A D09-Oct-202054 43

.travis.ymlH A D09-Oct-20203.2 KiB7968

MakefileH A D03-May-2022421 1912

README.markdownH A D09-Oct-202027.6 KiB738512

dist.iniH A D09-Oct-2020276 109

valgrind.suppressH A D09-Oct-20207.3 KiB380379

README.markdown

1Name
2====
3
4lua-resty-redis - Lua redis client driver for the ngx_lua based on the cosocket API
5
6Table of Contents
7=================
8
9* [Name](#name)
10* [Status](#status)
11* [Description](#description)
12* [Synopsis](#synopsis)
13* [Methods](#methods)
14    * [new](#new)
15    * [connect](#connect)
16    * [set_timeout](#set_timeout)
17    * [set_timeouts](#set_timeouts)
18    * [set_keepalive](#set_keepalive)
19    * [get_reused_times](#get_reused_times)
20    * [close](#close)
21    * [init_pipeline](#init_pipeline)
22    * [commit_pipeline](#commit_pipeline)
23    * [cancel_pipeline](#cancel_pipeline)
24    * [hmset](#hmset)
25    * [array_to_hash](#array_to_hash)
26    * [read_reply](#read_reply)
27    * [add_commands](#add_commands)
28* [Redis Authentication](#redis-authentication)
29* [Redis Transactions](#redis-transactions)
30* [Load Balancing and Failover](#load-balancing-and-failover)
31* [Debugging](#debugging)
32* [Automatic Error Logging](#automatic-error-logging)
33* [Check List for Issues](#check-list-for-issues)
34* [Limitations](#limitations)
35* [Installation](#installation)
36* [TODO](#todo)
37* [Community](#community)
38    * [English Mailing List](#english-mailing-list)
39    * [Chinese Mailing List](#chinese-mailing-list)
40* [Bugs and Patches](#bugs-and-patches)
41* [Author](#author)
42* [Copyright and License](#copyright-and-license)
43* [See Also](#see-also)
44
45Status
46======
47
48This library is considered production ready.
49
50Description
51===========
52
53This Lua library is a Redis client driver for the ngx_lua nginx module:
54
55https://github.com/openresty/lua-nginx-module/#readme
56
57This Lua library takes advantage of ngx_lua's cosocket API, which ensures
58100% nonblocking behavior.
59
60Note that at least [ngx_lua 0.5.14](https://github.com/chaoslawful/lua-nginx-module/tags) or [OpenResty 1.2.1.14](http://openresty.org/#Download) is required.
61
62Synopsis
63========
64
65```lua
66    # you do not need the following line if you are using
67    # the OpenResty bundle:
68    lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
69
70    server {
71        location /test {
72            content_by_lua_block {
73                local redis = require "resty.redis"
74                local red = redis:new()
75
76                red:set_timeouts(1000, 1000, 1000) -- 1 sec
77
78                -- or connect to a unix domain socket file listened
79                -- by a redis server:
80                --     local ok, err = red:connect("unix:/path/to/redis.sock")
81
82                local ok, err = red:connect("127.0.0.1", 6379)
83                if not ok then
84                    ngx.say("failed to connect: ", err)
85                    return
86                end
87
88                ok, err = red:set("dog", "an animal")
89                if not ok then
90                    ngx.say("failed to set dog: ", err)
91                    return
92                end
93
94                ngx.say("set result: ", ok)
95
96                local res, err = red:get("dog")
97                if not res then
98                    ngx.say("failed to get dog: ", err)
99                    return
100                end
101
102                if res == ngx.null then
103                    ngx.say("dog not found.")
104                    return
105                end
106
107                ngx.say("dog: ", res)
108
109                red:init_pipeline()
110                red:set("cat", "Marry")
111                red:set("horse", "Bob")
112                red:get("cat")
113                red:get("horse")
114                local results, err = red:commit_pipeline()
115                if not results then
116                    ngx.say("failed to commit the pipelined requests: ", err)
117                    return
118                end
119
120                for i, res in ipairs(results) do
121                    if type(res) == "table" then
122                        if res[1] == false then
123                            ngx.say("failed to run command ", i, ": ", res[2])
124                        else
125                            -- process the table value
126                        end
127                    else
128                        -- process the scalar value
129                    end
130                end
131
132                -- put it into the connection pool of size 100,
133                -- with 10 seconds max idle time
134                local ok, err = red:set_keepalive(10000, 100)
135                if not ok then
136                    ngx.say("failed to set keepalive: ", err)
137                    return
138                end
139
140                -- or just close the connection right away:
141                -- local ok, err = red:close()
142                -- if not ok then
143                --     ngx.say("failed to close: ", err)
144                --     return
145                -- end
146            }
147        }
148    }
149```
150
151[Back to TOC](#table-of-contents)
152
153Methods
154=======
155
156All of the Redis commands have their own methods with the same name except all in lower case.
157
158You can find the complete list of Redis commands here:
159
160http://redis.io/commands
161
162You need to check out this Redis command reference to see what Redis command accepts what arguments.
163
164The Redis command arguments can be directly fed into the corresponding method call. For example, the "GET" redis command accepts a single key argument, then you can just call the "get" method like this:
165
166```lua
167    local res, err = red:get("key")
168```
169
170Similarly, the "LRANGE" redis command accepts threee arguments, then you should call the "lrange" method like this:
171
172```lua
173    local res, err = red:lrange("nokey", 0, 1)
174```
175
176For example, "SET", "GET", "LRANGE", and "BLPOP" commands correspond to the methods "set", "get", "lrange", and "blpop".
177
178Here are some more examples:
179
180```lua
181    -- HMGET myhash field1 field2 nofield
182    local res, err = red:hmget("myhash", "field1", "field2", "nofield")
183```
184
185```lua
186    -- HMSET myhash field1 "Hello" field2 "World"
187    local res, err = red:hmset("myhash", "field1", "Hello", "field2", "World")
188```
189
190All these command methods returns a single result in success and `nil` otherwise. In case of errors or failures, it will also return a second value which is a string describing the error.
191
192A Redis "status reply" results in a string typed return value with the "+" prefix stripped.
193
194A Redis "integer reply" results in a Lua number typed return value.
195
196A Redis "error reply" results in a `false` value *and* a string describing the error.
197
198A non-nil Redis "bulk reply" results in a Lua string as the return value. A nil bulk reply results in a `ngx.null` return value.
199
200A non-nil Redis "multi-bulk reply" results in a Lua table holding all the composing values (if any). If any of the composing value is a valid redis error value, then it will be a two element table `{false, err}`.
201
202A nil multi-bulk reply returns in a `ngx.null` value.
203
204See http://redis.io/topics/protocol for details regarding various Redis reply types.
205
206In addition to all those redis command methods, the following methods are also provided:
207
208[Back to TOC](#table-of-contents)
209
210new
211---
212`syntax: red, err = redis:new()`
213
214Creates a redis object. In case of failures, returns `nil` and a string describing the error.
215
216[Back to TOC](#table-of-contents)
217
218connect
219-------
220`syntax: ok, err = red:connect(host, port, options_table?)`
221
222`syntax: ok, err = red:connect("unix:/path/to/unix.sock", options_table?)`
223
224Attempts to connect to the remote host and port that the redis server is listening to or a local unix domain socket file listened by the redis server.
225
226Before actually resolving the host name and connecting to the remote backend, this method will always look up the connection pool for matched idle connections created by previous calls of this method.
227
228The optional `options_table` argument is a Lua table holding the following keys:
229
230* `ssl`
231
232    If set to true, then uses SSL to connect to redis (defaults to false).
233
234* `ssl_verify`
235
236    If set to true, then verifies the validity of the server SSL certificate (defaults to false). Note that you need to configure the lua_ssl_trusted_certificate to specify the CA (or server) certificate used by your redis server. You may also need to configure lua_ssl_verify_depth accordingly.
237
238* `server_name`
239
240    Specifies the server name for the new TLS extension Server Name Indication (SNI) when connecting over SSL.
241
242* `pool`
243
244    Specifies a custom name for the connection pool being used. If omitted, then the connection pool name will be generated from the string template `<host>:<port>` or `<unix-socket-path>`.
245
246* `pool_size`
247
248    Specifies the size of the connection pool. If omitted and no `backlog` option was provided, no pool will be created. If omitted but `backlog` was provided, the pool will be created with a default size equal to the value of the [lua_socket_pool_size](https://github.com/openresty/lua-nginx-module#lua_socket_pool_size) directive. The connection pool holds up to `pool_size` alive connections ready to be reused by subsequent calls to [connect](#connect), but note that there is no upper limit to the total number of opened connections outside of the pool. If you need to restrict the total number of opened connections, specify the `backlog` option. When the connection pool would exceed its size limit, the least recently used (kept-alive) connection already in the pool will be closed to make room for the current connection. Note that the cosocket connection pool is per Nginx worker process rather than per Nginx server instance, so the size limit specified here also applies to every single Nginx worker process. Also note that the size of the connection pool cannot be changed once it has been created. Note that at least [ngx_lua 0.10.14](https://github.com/openresty/lua-nginx-module/tags) is required to use this options.
249
250* `backlog`
251
252    If specified, this module will limit the total number of opened connections for this pool. No more connections than `pool_size` can be opened for this pool at any time. If the connection pool is full, subsequent connect operations will be queued into a queue equal to this option's value (the "backlog" queue). If the number of queued connect operations is equal to `backlog`, subsequent connect operations will fail and return nil plus the error string `"too many waiting connect operations"`. The queued connect operations will be resumed once the number of connections in the pool is less than `pool_size`. The queued connect operation will abort once they have been queued for more than `connect_timeout`, controlled by [set_timeout](#set_timeout), and will return nil plus the error string "timeout". Note that at least [ngx_lua 0.10.14](https://github.com/openresty/lua-nginx-module/tags) is required to use this options.
253
254[Back to TOC](#table-of-contents)
255
256set_timeout
257-----------
258`syntax: red:set_timeout(time)`
259
260Sets the timeout (in ms) protection for subsequent operations, including the `connect` method.
261
262Since version `v0.28` of this module, it is advised that
263[set_timeouts](#set_timeouts) be used in favor of this method.
264
265[Back to TOC](#table-of-contents)
266
267set_timeouts
268------------
269`syntax: red:set_timeouts(connect_timeout, send_timeout, read_timeout)`
270
271Respectively sets the connect, send, and read timeout thresholds (in ms), for
272subsequent socket operations. Setting timeout thresholds with this method
273offers more granularity than [set_timeout](#set_timeout). As such, it is
274preferred to use [set_timeouts](#set_timeouts) over
275[set_timeout](#set_timeout).
276
277This method was added in the `v0.28` release.
278
279[Back to TOC](#table-of-contents)
280
281set_keepalive
282-------------
283`syntax: ok, err = red:set_keepalive(max_idle_timeout, pool_size)`
284
285Puts the current Redis connection immediately into the ngx_lua cosocket connection pool.
286
287You can specify the max idle timeout (in ms) when the connection is in the pool and the maximal size of the pool every nginx worker process.
288
289In case of success, returns `1`. In case of errors, returns `nil` with a string describing the error.
290
291Only call this method in the place you would have called the `close` method instead. Calling this method will immediately turn the current redis object into the `closed` state. Any subsequent operations other than `connect()` on the current object will return the `closed` error.
292
293[Back to TOC](#table-of-contents)
294
295get_reused_times
296----------------
297`syntax: times, err = red:get_reused_times()`
298
299This method returns the (successfully) reused times for the current connection. In case of error, it returns `nil` and a string describing the error.
300
301If the current connection does not come from the built-in connection pool, then this method always returns `0`, that is, the connection has never been reused (yet). If the connection comes from the connection pool, then the return value is always non-zero. So this method can also be used to determine if the current connection comes from the pool.
302
303[Back to TOC](#table-of-contents)
304
305close
306-----
307`syntax: ok, err = red:close()`
308
309Closes the current redis connection and returns the status.
310
311In case of success, returns `1`. In case of errors, returns `nil` with a string describing the error.
312
313[Back to TOC](#table-of-contents)
314
315init_pipeline
316-------------
317`syntax: red:init_pipeline()`
318
319`syntax: red:init_pipeline(n)`
320
321Enable the redis pipelining mode. All subsequent calls to Redis command methods will automatically get cached and will send to the server in one run when the `commit_pipeline` method is called or get cancelled by calling the `cancel_pipeline` method.
322
323This method always succeeds.
324
325If the redis object is already in the Redis pipelining mode, then calling this method will discard existing cached Redis queries.
326
327The optional `n` argument specifies the (approximate) number of commands that are going to add to this pipeline, which can make things a little faster.
328
329[Back to TOC](#table-of-contents)
330
331commit_pipeline
332---------------
333`syntax: results, err = red:commit_pipeline()`
334
335Quits the pipelining mode by committing all the cached Redis queries to the remote server in a single run. All the replies for these queries will be collected automatically and are returned as if a big multi-bulk reply at the highest level.
336
337This method returns `nil` and a Lua string describing the error upon failures.
338
339[Back to TOC](#table-of-contents)
340
341cancel_pipeline
342---------------
343`syntax: red:cancel_pipeline()`
344
345Quits the pipelining mode by discarding all existing cached Redis commands since the last call to the `init_pipeline` method.
346
347This method always succeeds.
348
349If the redis object is not in the Redis pipelining mode, then this method is a no-op.
350
351[Back to TOC](#table-of-contents)
352
353hmset
354-----
355`syntax: res, err = red:hmset(myhash, field1, value1, field2, value2, ...)`
356
357`syntax: res, err = red:hmset(myhash, { field1 = value1, field2 = value2, ... })`
358
359Special wrapper for the Redis "hmset" command.
360
361When there are only three arguments (including the "red" object
362itself), then the last argument must be a Lua table holding all the field/value pairs.
363
364[Back to TOC](#table-of-contents)
365
366array_to_hash
367-------------
368`syntax: hash = red:array_to_hash(array)`
369
370Auxiliary function that converts an array-like Lua table into a hash-like table.
371
372This method was first introduced in the `v0.11` release.
373
374[Back to TOC](#table-of-contents)
375
376read_reply
377----------
378`syntax: res, err = red:read_reply()`
379
380Reading a reply from the redis server. This method is mostly useful for the [Redis Pub/Sub API](http://redis.io/topics/pubsub/), for example,
381
382```lua
383    local cjson = require "cjson"
384    local redis = require "resty.redis"
385
386    local red = redis:new()
387    local red2 = redis:new()
388
389    red:set_timeouts(1000, 1000, 1000) -- 1 sec
390    red2:set_timeouts(1000, 1000, 1000) -- 1 sec
391
392    local ok, err = red:connect("127.0.0.1", 6379)
393    if not ok then
394        ngx.say("1: failed to connect: ", err)
395        return
396    end
397
398    ok, err = red2:connect("127.0.0.1", 6379)
399    if not ok then
400        ngx.say("2: failed to connect: ", err)
401        return
402    end
403
404    local res, err = red:subscribe("dog")
405    if not res then
406        ngx.say("1: failed to subscribe: ", err)
407        return
408    end
409
410    ngx.say("1: subscribe: ", cjson.encode(res))
411
412    res, err = red2:publish("dog", "Hello")
413    if not res then
414        ngx.say("2: failed to publish: ", err)
415        return
416    end
417
418    ngx.say("2: publish: ", cjson.encode(res))
419
420    res, err = red:read_reply()
421    if not res then
422        ngx.say("1: failed to read reply: ", err)
423        return
424    end
425
426    ngx.say("1: receive: ", cjson.encode(res))
427
428    red:close()
429    red2:close()
430```
431
432Running this example gives the output like this:
433
434    1: subscribe: ["subscribe","dog",1]
435    2: publish: 1
436    1: receive: ["message","dog","Hello"]
437
438The following class methods are provieded:
439
440[Back to TOC](#table-of-contents)
441
442add_commands
443------------
444`syntax: hash = redis.add_commands(cmd_name1, cmd_name2, ...)`
445
446*WARNING* this method is now deprecated since we already do automatic Lua method generation
447for any redis commands the user attempts to use and thus we no longer need this.
448
449Adds new redis commands to the `resty.redis` class. Here is an example:
450
451```lua
452    local redis = require "resty.redis"
453
454    redis.add_commands("foo", "bar")
455
456    local red = redis:new()
457
458    red:set_timeouts(1000, 1000, 1000) -- 1 sec
459
460    local ok, err = red:connect("127.0.0.1", 6379)
461    if not ok then
462        ngx.say("failed to connect: ", err)
463        return
464    end
465
466    local res, err = red:foo("a")
467    if not res then
468        ngx.say("failed to foo: ", err)
469    end
470
471    res, err = red:bar()
472    if not res then
473        ngx.say("failed to bar: ", err)
474    end
475```
476
477[Back to TOC](#table-of-contents)
478
479Redis Authentication
480====================
481
482Redis uses the `AUTH` command to do authentication: http://redis.io/commands/auth
483
484There is nothing special for this command as compared to other Redis
485commands like `GET` and `SET`. So one can just invoke the `auth` method on your `resty.redis` instance. Here is an example:
486
487```lua
488    local redis = require "resty.redis"
489    local red = redis:new()
490
491    red:set_timeouts(1000, 1000, 1000) -- 1 sec
492
493    local ok, err = red:connect("127.0.0.1", 6379)
494    if not ok then
495        ngx.say("failed to connect: ", err)
496        return
497    end
498
499    local res, err = red:auth("foobared")
500    if not res then
501        ngx.say("failed to authenticate: ", err)
502        return
503    end
504```
505
506where we assume that the Redis server is configured with the
507password `foobared` in the `redis.conf` file:
508
509    requirepass foobared
510
511If the password specified is wrong, then the sample above will output the
512following to the HTTP client:
513
514    failed to authenticate: ERR invalid password
515
516[Back to TOC](#table-of-contents)
517
518Redis Transactions
519==================
520
521This library supports the [Redis transactions](http://redis.io/topics/transactions/). Here is an example:
522
523```lua
524    local cjson = require "cjson"
525    local redis = require "resty.redis"
526    local red = redis:new()
527
528    red:set_timeouts(1000, 1000, 1000) -- 1 sec
529
530    local ok, err = red:connect("127.0.0.1", 6379)
531    if not ok then
532        ngx.say("failed to connect: ", err)
533        return
534    end
535
536    local ok, err = red:multi()
537    if not ok then
538        ngx.say("failed to run multi: ", err)
539        return
540    end
541    ngx.say("multi ans: ", cjson.encode(ok))
542
543    local ans, err = red:set("a", "abc")
544    if not ans then
545        ngx.say("failed to run sort: ", err)
546        return
547    end
548    ngx.say("set ans: ", cjson.encode(ans))
549
550    local ans, err = red:lpop("a")
551    if not ans then
552        ngx.say("failed to run sort: ", err)
553        return
554    end
555    ngx.say("set ans: ", cjson.encode(ans))
556
557    ans, err = red:exec()
558    ngx.say("exec ans: ", cjson.encode(ans))
559
560    red:close()
561```
562
563Then the output will be
564
565    multi ans: "OK"
566    set ans: "QUEUED"
567    set ans: "QUEUED"
568    exec ans: ["OK",[false,"ERR Operation against a key holding the wrong kind of value"]]
569
570[Back to TOC](#table-of-contents)
571
572Load Balancing and Failover
573===========================
574
575You can trivially implement your own Redis load balancing logic yourself in Lua. Just keep a Lua table of all available Redis backend information (like host name and port numbers) and pick one server according to some rule (like round-robin or key-based hashing) from the Lua table at every request. You can keep track of the current rule state in your own Lua module's data, see https://github.com/openresty/lua-nginx-module/#data-sharing-within-an-nginx-worker
576
577Similarly, you can implement automatic failover logic in Lua at great flexibility.
578
579[Back to TOC](#table-of-contents)
580
581Debugging
582=========
583
584It is usually convenient to use the [lua-cjson](http://www.kyne.com.au/~mark/software/lua-cjson.php) library to encode the return values of the redis command methods to JSON. For example,
585
586```lua
587    local cjson = require "cjson"
588    ...
589    local res, err = red:mget("h1234", "h5678")
590    if res then
591        print("res: ", cjson.encode(res))
592    end
593```
594
595[Back to TOC](#table-of-contents)
596
597Automatic Error Logging
598=======================
599
600By default the underlying [ngx_lua](https://github.com/openresty/lua-nginx-module/#readme) module
601does error logging when socket errors happen. If you are already doing proper error
602handling in your own Lua code, then you are recommended to disable this automatic error logging by turning off [ngx_lua](https://github.com/openresty/lua-nginx-module/#readme)'s [lua_socket_log_errors](https://github.com/openresty/lua-nginx-module/#lua_socket_log_errors) directive, that is,
603
604```nginx
605    lua_socket_log_errors off;
606```
607
608[Back to TOC](#table-of-contents)
609
610Check List for Issues
611=====================
612
6131. Ensure you configure the connection pool size properly in the [set_keepalive](#set_keepalive) . Basically if your NGINX handle `n` concurrent requests and your NGINX has `m` workers, then the connection pool size should be configured as `n/m`. For example, if your NGINX usually handles 1000 concurrent requests and you have 10 NGINX workers, then the connection pool size should be 100.
6142. Ensure the backlog setting on the Redis side is large enough. For Redis 2.8+, you can directly tune the `tcp-backlog` parameter in the `redis.conf` file (and also tune the kernel parameter `SOMAXCONN` accordingly at least on Linux). You may also want to tune the `maxclients` parameter in `redis.conf`.
6153. Ensure you are not using too short timeout setting in the [set_timeout](#set_timeout) or [set_timeouts](#set_timeouts) methods. If you have to, try redoing the operation upon timeout and turning off [automatic error logging](#automatic-error-logging) (because you are already doing proper error handling in your own Lua code).
6164. If your NGINX worker processes' CPU usage is very high under load, then the NGINX event loop might be blocked by the CPU computation too much. Try sampling a [C-land on-CPU Flame Graph](https://github.com/agentzh/nginx-systemtap-toolkit#sample-bt) and [Lua-land on-CPU Flame Graph](https://github.com/agentzh/stapxx#ngx-lj-lua-stacks) for a typical NGINX worker process. You can optimize the CPU-bound things according to these Flame Graphs.
6175. If your NGINX worker processes' CPU usage is very low under load, then the NGINX event loop might be blocked by some blocking system calls (like file IO system calls). You can confirm the issue by running the [epoll-loop-blocking-distr](https://github.com/agentzh/stapxx#epoll-loop-blocking-distr) tool against a typical NGINX worker process. If it is indeed the case, then you can further sample a [C-land off-CPU Flame Graph](https://github.com/agentzh/nginx-systemtap-toolkit#sample-bt-off-cpu) for a NGINX worker process to analyze the actual blockers.
6186. If your `redis-server` process is running near 100% CPU usage, then you should consider scale your Redis backend by multiple nodes or use the [C-land on-CPU Flame Graph tool](https://github.com/agentzh/nginx-systemtap-toolkit#sample-bt) to analyze the internal bottlenecks within the Redis server process.
619
620[Back to TOC](#table-of-contents)
621
622Limitations
623===========
624
625* This library cannot be used in code contexts like init_by_lua*, set_by_lua*, log_by_lua*, and
626header_filter_by_lua* where the ngx_lua cosocket API is not available.
627* The `resty.redis` object instance cannot be stored in a Lua variable at the Lua module level,
628because it will then be shared by all the concurrent requests handled by the same nginx
629 worker process (see
630https://github.com/openresty/lua-nginx-module/#data-sharing-within-an-nginx-worker ) and
631result in bad race conditions when concurrent requests are trying to use the same `resty.redis` instance
632(you would see the "bad request" or "socket busy" error to be returned from the method calls).
633You should always initiate `resty.redis` objects in function local
634variables or in the `ngx.ctx` table. These places all have their own data copies for
635each request.
636
637[Back to TOC](#table-of-contents)
638
639Installation
640============
641
642If you are using the OpenResty bundle (http://openresty.org ), then
643you do not need to do anything because it already includes and enables
644lua-resty-redis by default. And you can just use it in your Lua code,
645as in
646
647```lua
648    local redis = require "resty.redis"
649    ...
650```
651
652If you are using your own nginx + ngx_lua build, then you need to configure
653the lua_package_path directive to add the path of your lua-resty-redis source
654tree to ngx_lua's LUA_PATH search path, as in
655
656```nginx
657    # nginx.conf
658    http {
659        lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
660        ...
661    }
662```
663
664Ensure that the system account running your Nginx ''worker'' proceses have
665enough permission to read the `.lua` file.
666
667[Back to TOC](#table-of-contents)
668
669TODO
670====
671
672[Back to TOC](#table-of-contents)
673
674Community
675=========
676
677[Back to TOC](#table-of-contents)
678
679English Mailing List
680--------------------
681
682The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers.
683
684[Back to TOC](#table-of-contents)
685
686Chinese Mailing List
687--------------------
688
689The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers.
690
691[Back to TOC](#table-of-contents)
692
693Bugs and Patches
694================
695
696Please report bugs or submit patches by
697
6981. creating a ticket on the [GitHub Issue Tracker](http://github.com/agentzh/lua-resty-redis/issues),
6991. or posting to the [OpenResty community](#community).
700
701[Back to TOC](#table-of-contents)
702
703Author
704======
705
706Yichun "agentzh" Zhang (章亦春) <agentzh@gmail.com>, OpenResty Inc.
707
708[Back to TOC](#table-of-contents)
709
710Copyright and License
711=====================
712
713This module is licensed under the BSD license.
714
715Copyright (C) 2012-2017, by Yichun Zhang (agentzh) <agentzh@gmail.com>, OpenResty Inc.
716
717All rights reserved.
718
719Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
720
721* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
722
723* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
724
725THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
726
727[Back to TOC](#table-of-contents)
728
729See Also
730========
731* the ngx_lua module: https://github.com/openresty/lua-nginx-module/#readme
732* the redis wired protocol specification: http://redis.io/topics/protocol
733* the [lua-resty-memcached](https://github.com/agentzh/lua-resty-memcached) library
734* the [lua-resty-mysql](https://github.com/agentzh/lua-resty-mysql) library
735
736[Back to TOC](#table-of-contents)
737
738