{"id":20314868,"url":"https://github.com/windvalley/lua-resty-redis","last_synced_at":"2025-12-02T05:11:51.107Z","repository":{"id":163372278,"uuid":"220946459","full_name":"windvalley/lua-resty-redis","owner":"windvalley","description":"Lua redis client for the ngx_lua based on openresty/lua-resty-redis.","archived":false,"fork":false,"pushed_at":"2020-10-20T02:38:18.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T08:45:47.111Z","etag":null,"topics":["lua","openresty","redis"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/windvalley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-11T09:33:57.000Z","updated_at":"2023-02-04T03:56:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a79c80f-ecaa-4bdb-a057-3b985ffccaa1","html_url":"https://github.com/windvalley/lua-resty-redis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/windvalley/lua-resty-redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Flua-resty-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Flua-resty-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Flua-resty-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Flua-resty-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windvalley","download_url":"https://codeload.github.com/windvalley/lua-resty-redis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Flua-resty-redis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27446435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-02T02:00:06.387Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","openresty","redis"],"created_at":"2024-11-14T18:17:01.685Z","updated_at":"2025-12-02T05:11:51.088Z","avatar_url":"https://github.com/windvalley.png","language":"Lua","readme":"# Name\n\n`lua-resty-redis` - Lua redis client for the ngx_lua based on openresty/lua-resty-redis.\n\n## Usage\n\nThe `redis` operation method is basically the same as the official `redis` library.\nIt just saves the steps of setting timeout time, creating connection, setting `keepalive` connection pool, closing connection, etc.\nIt greatly facilitates our operation.\n\n### Redis basic commands\n\n```lua\nlocal redis = require \"redis_wrap\"\n\n-- Redis configuration parameter list, if you don't want to enable keepalive,\n-- you need to remove the two elements of keepalive in the table below,\n-- and then add a new one: keepalive = \"off\".\nlocal redis_opts = {\n    db_index = 1,\n    timeout = 2000, -- 2 seconds.\n    keepalive_max_idle_timeout = 10000, -- 10 seconds.\n    keepalive_pool_size = 20,\n}\n\n-- Get the redis object.\nlocal red = redis:new(redis_opts)\n\n-- set\nlocal ok, err = red:set(\"dog\", \"an animal\")\nif not ok then\n    ngx.say(\"failed to set dog: \", err)\n    return\nend\n\n-- get\nlocal res, err = red:get(\"dog\")\nif not res then\n    ngx.say(\"failed to get dog: \", err)\n    return\nend\n```\n\n### Pipeline requests\n\n```lua\nlocal redis = require \"redis_wrap\"\n\nlocal redis_opts = {\n    db_index = 1,\n    timeout = 2000, -- 2 seconds.\n    keepalive_max_idle_timeout = 10000, -- 10 seconds.\n    keepalive_pool_size = 20,\n}\n\nlocal red = redis:new(redis_opts)\n\n-- Parameters can be omitted, adding parameters is for efficient processing when the number of command entries is known.\nred:init_pipeline(4)\n\nred:set(\"dog\", \"111\")\nred:set(\"cat\", \"222\")\nred:get(\"cat\")\nred:get(\"dog\")\n\nlocal results, err = red:commit_pipeline()\nif not results then\n    ngx.say(\"failed to commit the pipelined requests: \", err)\n    return\nend\n```\n\n## References\n\nhttps://github.com/openresty/lua-resty-redis\n\nhttps://moonbingbing.gitbooks.io/openresty-best-practices/content/redis/out_package.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Flua-resty-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindvalley%2Flua-resty-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Flua-resty-redis/lists"}