{"id":16904673,"url":"https://github.com/rainingmaster/lua-purge-nginx-module","last_synced_at":"2026-05-06T00:37:48.161Z","repository":{"id":88266123,"uuid":"276539205","full_name":"rainingmaster/lua-purge-nginx-module","owner":"rainingmaster","description":null,"archived":false,"fork":false,"pushed_at":"2020-07-14T13:43:42.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-25T20:25:40.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rainingmaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-07-02T03:28:17.000Z","updated_at":"2020-07-14T13:43:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f93ae02-c7b6-463d-9c0c-5df3ac15f5ea","html_url":"https://github.com/rainingmaster/lua-purge-nginx-module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2Flua-purge-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2Flua-purge-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2Flua-purge-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2Flua-purge-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rainingmaster","download_url":"https://codeload.github.com/rainingmaster/lua-purge-nginx-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235593326,"owners_count":19015141,"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","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":[],"created_at":"2024-10-13T18:34:52.069Z","updated_at":"2025-10-15T08:49:17.654Z","avatar_url":"https://github.com/rainingmaster.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n====\n\nlua-purge-nginx-module - NGINX C module that extends `ngx_http_lua_module` for enhanced NGINX cache purge capabilities\n\nTable of Contents\n=================\n\n* [NAME](#name)\n* [Synopsis](#synopsis)\n* [Description](#description)\n* [Methods](#methods)\n* [Installation](#installation)\n* [Author](#author)\n* [Copyright and License](#copyright-and-license)\n\nSynopsis\n========\n\n```nginx\nhttp {\n    lua_package_path \"/path/to/lua-purge-nginx-module/lualib/?.lua;;\";\n\n    lua_shared_dict my_cache 10m;\n    lua_shared_dict locks 1m;\n\n    proxy_cache_path  /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m;\n    proxy_temp_path   /tmp/ngx_cache_purge_temp 1 2;\n    \n    upstream hello_world {\n        server 127.0.0.1:1990;\n    }\n    \n    server {\n        listen 1989;\n        location / {\n            content_by_lua_block {\n                ngx.say(\"hello world\")\n            }\n        }\n    }\n    \n    server {\n        listen 1991;\n        server_name     'localhost';\n        location /cache {\n            proxy_pass         http://hello_world;\n            proxy_cache        test_cache;\n            proxy_cache_key    \\$uri;\n            proxy_cache_valid  3m;\n            add_header         X-Cache-Status \\$upstream_cache_status;\n            more_clear_headers Date;\n        }\n    }\n\n    server {\n        listen 1990;\n        server_name \"foo.com\";\n\n        location = /t {\n            content_by_lua_block {\n                local resty_purge = require \"resty.purge\"\n\n                local key = \"/cache\";\n                local cache_zone, err = resty_purge.get_zone(\"test_cache\")\n                if not cache_zone then\n                    ngx.say(\"get zone failed: \", err)\n                    return\n                end\n\n                ngx.say(\"get zone success\")\n\n                local res, err = resty_purge.purge(cache_zone, key)\n                if not res then\n                    ngx.say(\"purge failed: \", err)\n                    return\n                end\n\n                ngx.say(\"purge success\")\n            }\n        }\n    }\n\n    ...\n}\n```\n\nDescription\n=======\n\nThis module is nginx module which adds ability to purge content from proxy caches. And it is ported from [ngx_cache_purge](https://github.com/FRiCKLE/ngx_cache_purge)\n\nMethods\n=======\n\nThis section documents the methods for the `resty.purge` Lua module.\n\nget_zone\n-------------------\n**syntax:** *cache_zone, err = resty_purge.get_zone(name)*\n\nGet the `cache_zone` by `name`.\n\npurge\n------------------\n**syntax:** *err = resty_purge.purge(cache_zone, key)*\n\nPurge the data by `key` in `cache_zone`.\n\nInstallation\n============\n\nThis module depends on [lua-nginx-module](https://github.com/openresty/lua-nginx-module).\n\nIf you are using the official nginx distribution, then build like this:\n\n```bash\n./configure --add-module=/path/to/lua-nginx-module \\\n            --add-module=/path/to/lua-purge-nginx-module\nmake\nsudo make install\n```\n\nOtherwise, if you are using the OpenResty distribution, build it as follows:\n\n```bash\n./configure --add-module=/path/to/lua-purge-nginx-module\nmake\nsudo make install\n```\n\n[Back to TOC](#table-of-contents)\n\nAuthor\n======\n\n* rainingmaster.\n\n[Back to TOC](#table-of-contents)\n\nCopyright and License\n=====================\n\nThis module is licensed under the BSD license.\n\nCopyright (C) 2020, by rainingmaster.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n* 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.\n\nTHIS 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.\n\n[Back to TOC](#table-of-contents)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainingmaster%2Flua-purge-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frainingmaster%2Flua-purge-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainingmaster%2Flua-purge-nginx-module/lists"}