New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the option to purge cache files directly without ngx_cache_purge #78

merged 1 commit into from Apr 19, 2015


None yet
3 participants

bcole808 commented Apr 17, 2015

The issue

I needed to be able to purge cache files without using the ngx_cache_purge module.


This pull request adds an option to the "Purge Options" area to allow the site admin to choose how cache files should be purged. The default option is to use a GET request to the /purge version of the URL, as required by ngx_cache_purge. The second option lets the plugin directly remove the cache files from the server.

Screenshot of new option:

screen shot 2015-04-17 at 4 07 04 pm

How it works

I followed information from this article to compute the correct cache file to delete. The URL to delete is hashed with md5 and then given a specific folder and file name based on that hash.


In order for the "delete local files" option to work, the following must all be true:

  • Cache is stored on the same server and * RT_WP_NGINX_HELPER_CACHE_PATH* is defined.
  • Default nginx cache level must be used; levels=1:2
  • Cache key must be: fastcgi_cache_key "$scheme$request_method$host$request_uri"


So far it seems to work on my staging server tests. If someone else can help double check that everything is working great that would be much appreciated.

@bcole808 bcole808 changed the title from Added the option to purge cache files directly from disk to Added the option to purge cache files directly without ngx_cache_purge Apr 17, 2015

rahul286 added a commit that referenced this pull request Apr 19, 2015

Merge pull request #78 from bcole808/local-file-purge
Added the option to purge cache files directly without ngx_cache_purge

@rahul286 rahul286 merged commit a776dcd into rtCamp:master Apr 19, 2015

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
continuous-integration/wercker Wercker build passed

This comment has been minimized.


rahul286 commented Apr 19, 2015

Thanks for amazing PR, both in terms of functionality and documentation. :-)


This comment has been minimized.

ghost commented Apr 21, 2015

Very nice indeed, thanks!


This comment has been minimized.

cromulus commented May 1, 2015

Just a note: could we allow RT_WP_NGINX_HELPER_CACHE_PATH to be defined in the user interface? Or print it's current value?

I love this PR! Great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment