11About
22=====
33` ngx_cache_purge ` is ` nginx ` module which adds ability to purge content from
4- ` FastCGI ` , ` proxy ` , ` SCGI ` and ` uWSGI ` caches.
4+ ` FastCGI ` , ` proxy ` , ` SCGI ` and ` uWSGI ` caches. A purge operation removes the
5+ content with the same cache key as the purge request has.
56
67
78Sponsors
@@ -18,7 +19,7 @@ Configuration directives (same location syntax)
1819===============================================
1920fastcgi_cache_purge
2021-------------------
21- * ** syntax** : ` fastcgi_cache_purge on|off|<method> [from all|<ip> [.. <ip>]] `
22+ * ** syntax** : ` fastcgi_cache_purge on|off|<method> [purge_all] [ from all|<ip> [.. <ip>]] `
2223* ** default** : ` none `
2324* ** context** : ` http ` , ` server ` , ` location `
2425
@@ -27,7 +28,7 @@ Allow purging of selected pages from `FastCGI`'s cache.
2728
2829proxy_cache_purge
2930-----------------
30- * ** syntax** : ` proxy_cache_purge on|off|<method> [from all|<ip> [.. <ip>]] `
31+ * ** syntax** : ` proxy_cache_purge on|off|<method> [purge_all] [ from all|<ip> [.. <ip>]] `
3132* ** default** : ` none `
3233* ** context** : ` http ` , ` server ` , ` location `
3334
@@ -36,7 +37,7 @@ Allow purging of selected pages from `proxy`'s cache.
3637
3738scgi_cache_purge
3839----------------
39- * ** syntax** : ` scgi_cache_purge on|off|<method> [from all|<ip> [.. <ip>]] `
40+ * ** syntax** : ` scgi_cache_purge on|off|<method> [purge_all] [ from all|<ip> [.. <ip>]] `
4041* ** default** : ` none `
4142* ** context** : ` http ` , ` server ` , ` location `
4243
@@ -45,7 +46,7 @@ Allow purging of selected pages from `SCGI`'s cache.
4546
4647uwsgi_cache_purge
4748-----------------
48- * ** syntax** : ` uwsgi_cache_purge on|off|<method> [from all|<ip> [.. <ip>]] `
49+ * ** syntax** : ` uwsgi_cache_purge on|off|<method> [purge_all] [ from all|<ip> [.. <ip>]] `
4950* ** default** : ` none `
5051* ** context** : ` http ` , ` server ` , ` location `
5152
@@ -101,6 +102,18 @@ cache_purge_response_type
101102Sets a response type of purging result.
102103
103104
105+
106+ Partial Keys
107+ ============
108+ Sometimes it's not possible to pass the exact key cache to purge a page. For example; when the content of a cookie or the params are part of the key.
109+ You can specify a partial key adding an asterisk at the end of the URL.
110+
111+ curl -X PURGE /page*
112+
113+ The asterisk must be the last character of the key, so you ** must** put the $uri variable at the end.
114+
115+
116+
104117Sample configuration (same location syntax)
105118===========================================
106119 http {
@@ -117,6 +130,22 @@ Sample configuration (same location syntax)
117130 }
118131
119132
133+ Sample configuration (same location syntax - purge all cached files)
134+ ====================================================================
135+ http {
136+ proxy_cache_path /tmp/cache keys_zone=tmpcache:10m;
137+
138+ server {
139+ location / {
140+ proxy_pass http://127.0.0.1:8000;
141+ proxy_cache tmpcache;
142+ proxy_cache_key $uri$is_args$args;
143+ proxy_cache_purge PURGE purge_all from 127.0.0.1;
144+ }
145+ }
146+ }
147+
148+
120149Sample configuration (separate location syntax)
121150===============================================
122151 http {
0 commit comments