http-cache-purge #

Removes entries from FastCGI, proxy, SCGI and uWSGI caches on request. Use it when an application must invalidate cached pages after a change, instead of waiting for them to expire. Version 4 adds generation keys and REFRESH, both off until configured.

Source: upstream source

Directives

cache_purge_background_queue #

syntax: cache_purge_background_queue on | off;  ·  context: http

cache_purge_batch_size #

syntax: cache_purge_batch_size 1 arg (integer);  ·  context: http

Integer value.

cache_purge_key #

syntax: cache_purge_key 2 args;  ·  context: http, server, location

cache_purge_legacy_status #

syntax: cache_purge_legacy_status on | off;  ·  context: http

cache_purge_legacy_status only warns and no longer changes responses.

cache_purge_namespace #

syntax: cache_purge_namespace 3 args;  ·  context: http

cache_purge_queue_size #

syntax: cache_purge_queue_size 1 arg (integer);  ·  context: http

Integer value.

cache_purge_queue_status #

syntax: cache_purge_queue_status 1 arg;  ·  context: location

cache_purge_refresh_batch #

syntax: cache_purge_refresh_batch 1 arg (integer);  ·  context: http, server, location

Integer value.

cache_purge_refresh_profile #

syntax: cache_purge_refresh_profile 2 args;  ·  context: location

cache_purge_refresh_timeout #

syntax: cache_purge_refresh_timeout 1 arg (duration in ms);  ·  context: http, server, location

Duration in milliseconds; accepts ms / s / m suffixes.

cache_purge_response_type #

syntax: cache_purge_response_type 1 arg;  ·  context: http, server, location

cache_purge_thread_pool #

syntax: cache_purge_thread_pool 1 arg;  ·  context: http, server, location

cache_purge_throttle_ms #

syntax: cache_purge_throttle_ms 1 arg;  ·  context: http

The initial delay and bare integer settings are milliseconds.

cache_purge_traffic_class #

syntax: cache_purge_traffic_class 2+ args;  ·  context: http

cache_purge_vary_aware #

syntax: cache_purge_vary_aware on | off;  ·  context: http

fastcgi_cache_purge #

syntax: fastcgi_cache_purge 1+ args;  ·  context: http, server, location

proxy_cache_purge #

syntax: proxy_cache_purge 1+ args;  ·  context: http, server, location

proxy_cache_refresh #

syntax: proxy_cache_refresh 2 args;  ·  context: location

scgi_cache_purge #

syntax: scgi_cache_purge 1+ args;  ·  context: http, server, location

uwsgi_cache_purge #

syntax: uwsgi_cache_purge 1+ args;  ·  context: http, server, location

Example

    proxy_cache_purge PURGE from 127.0.0.1;
    location /cache {
        cache_purge_key refresh_if $uri;
        proxy_cache cache_zone;
        proxy_cache_key $cache_purge_key;
        proxy_cache_valid 200 1m;
        proxy_pass http://backend/origin;
    }
    location = /refresh {
        set $selected /unused;
        if ($arg_select = yes) { set $selected /cache/refresh25; }
        cache_purge_key refresh_if $selected;
        proxy_cache_refresh cache_zone $cache_purge_key;
        cache_purge_refresh_profile /probe /cache;
        allow 127.0.0.1; deny all;
    }
    location = /probe {
        internal;
        proxy_cache_purge off;
        proxy_cache off;
        proxy_intercept_errors off;
        proxy_pass_request_headers off;
        proxy_pass_request_body off;
        proxy_method HEAD;
        proxy_set_header Host origin.test;
        proxy_set_header If-None-Match $cache_purge_refresh_etag;
        proxy_set_header If-Modified-Since $cache_purge_refresh_last_modified;
        proxy_pass http://backend/origin$cache_purge_refresh_uri;
    }
    location /origin {
        if ($request_method = HEAD) { return 304; }
        return 200 "if-refresh";
    }

↑ back to index