OpenResty Lua Utils
Lua
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/resty Add redis client Oct 18, 2016
.gitignore Add redis client Oct 18, 2016
LICENSE Initial commit May 20, 2016
README.md Update README.md Oct 20, 2016
dist.ini OPM info Nov 12, 2016

README.md

Name

lua-resty-utils - OpenResty Lua Utils, include collections, redis.

Table of Contents

Synopsis

Collections

    # import module

    local collections = require("resty.collections")

    local expressions = {
    	"^/users/\\w+$",
    	"^/users/\\w+/trades/\\d+$"
    }

    local matched = collections.key_matched(expressions, "/users/W1234567")

    print(matched) -- print true

Redis

    # import module

    local redis = require("resty.rediscli")

    local red = redis.new({host = "127.0.0.1", ...})

    local res, err = red:exec(
        function(red)
            return red:get(key)
        end
    )