ngx_cache_purge
159 次浏览
更新于 2020-09-23 15:16

源码地址:

授权协议:Eclipse Public License
原作者联系方式:
功能说明:
  • 内容介绍

模块功能:

ngx_cache_purge is nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches. A purge operation removes the content with the same cache key as the purge request has.
可以通过请求URL的方式来清理缓存,让缓存失效

proxy_cache_purge

syntax: proxy_cache_purge on|off|<method> [purge_all] [from all|<ip> [.. <ip>]]
default: none
context: http, server, location
Allow purging of selected pages from proxy's cache.

配置案例:

http {
    proxy_cache_path  /tmp/cache  keys_zone=tmpcache:10m;

    server {
        location / {
            proxy_pass         http://127.0.0.1:8000;
            proxy_cache        tmpcache;
            proxy_cache_key    $uri$is_args$args;
        }

        location ~ /purge(/.*) {
            allow              127.0.0.1;
            deny               all;
            proxy_cache_purge  tmpcache $1$is_args$args;
        }
    }
}

更多详见:ngx_cache_purge

发表评论
提交者

Nginspher

日行一善

  • 0

    文章

  • 4

    关注

  • 5

    粉丝

版权所有©F5 Networks,Inc.保留所有权利。京ICP备16013763号-5