Zone cache invalidation module

    "Hid" the slow REST API for nginx.

    There are known difficulties - how to ensure cache coherency?

    If for a pair of url this could still be done purely through configuration, then with ten or more it was already beyond the bounds of common sense.
    All that Google saw was a little monstrous.

    I really wanted this (or similar) configuration:
    location ~ ^/zone_two/(.*)$ {
        proxy_cache            zone_two;
        proxy_cache_key        $document_uri;
        proxy_cache_valid      60m;
        set $do_invalidate 0;
        if ($request_method = PUT) {
            set $do_invalidate 1;
        }
        proxy_cache_invalidate $do_invalidate; # Tadaaa!!!
        proxy_pass             http://127.0.0.1:9102/$1;
    }
    


    As a result, a bicycle was born - github.com/egorse/ngx-proxy-cache-invalidate .
    Works with 1.8.0, 1.8.1.
    Other versions of nginx are not tested.

    Criticism is welcome in every way . Especially if nginx is for giblets.

    Update1: not a single element in the cache zone is disabled, but _all_ elements from the cache zone defined by proxy_cache.

    Also popular now: