-
Notifications
You must be signed in to change notification settings - Fork 312
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
Feature: Partial keys (includes pull #33) #35
base: master
Are you sure you want to change the base?
Conversation
This option can be slow if a lot of content is cached, or if the storage used for the cache is slow. But you really should be using RAM as your cache storage. Signed-off-by: Francisco Miguel Biete <[email protected]> <[email protected]>
Put an '*' at the end of your purge cache URL. e.g: proxy_cache_key $scheme$host$uri$is_args$args$cookie_JSESSIONID; curl -X PURGE https://example.com/pass* This will remove every cached page whose key cache starting with: httpsexample.com/pass* Be careful not passing any value for the values after the $uri, or put it at the end of your cache key. Signed-off-by: Francisco Miguel Biete <[email protected]> <[email protected]>
This might solve #24 |
@fmbiete Thanks for your work, this patch is exactly what I needed ! It's one of the most interesting features of nginx plus cache IMO. @PiotrSikora Can we have a word from the developer on this please ? Because according to https://github.com/FRiCKLE/ngx_cache_purge/blob/master/TODO.md , prefixed purges are "impossible". It would be amazing to have this officially included in the extension :) |
yes please @PiotrSikora I also need this ! |
@fmbiete I just compiled your fork and it does not work with nginx 1.9.5, I had crashes when I tried to make a simple purge (single page). I had no time to test more but I'll do it maybe later. |
@fmbiete thanks for your work, but this is far from useable (it doesn't invalidate items in cache, it doesn't look that it would work with AIO, and most importantly, it would block worker process for the time it needs to walk all the directories and read the files - which in pessimistic case can be as long as 1s for cache with as little as 100 files). |
@PiotrSikora Hello ! When you say it's impossible with the current implementation, can you explain why ? It could help us if we want to improve this plugin. |
Since the file corresponding to the cached item will not exist anymore nginx will invalidate the item. It's far from perfect, and I would love to find an alternative.
Of course, it will block the thread of the worker running the request, not the whole worker.
This should be used with the cache folder in RAM disks, and there this time will be almost zero. |
This option can be slow if a lot of content is cached, or if the storage used for the cache is slow. But you really should be using RAM as your cache storage. Signed-off-by: Francisco Miguel Biete <[email protected]> Signed-off-by: Francisco Miguel Biete <[email protected]> Resolved FRiCKLE#33 Resolved FRiCKLE#35
Put an '*' at the end of your purge cache URL. e.g: proxy_cache_key $scheme$host$uri$is_args$args$cookie_JSESSIONID; curl -X PURGE https://example.com/pass* This will remove every cached page whose key cache starting with: httpsexample.com/pass* Be careful not passing any value for the values after the $uri, or put it at the end of your cache key. Signed-off-by: Francisco Miguel Biete <[email protected]> Signed-off-by: Francisco Miguel Biete <[email protected]> Resolved FRiCKLE#33 Resolved FRiCKLE#35
It's very hard to purge some pic that has some relationship, like a.jpg , a/480x360.jpg, a/20x60.jpg and more. Please inform me if one day can be purge by pattern match.Thanks! |
This cause nginx worker exited when config as separate location, event purge without '*'. |
This pull includes #33, but each one is only a commit so it should be quite easy to cherry-pick. Sorry about that.
Adds support to partial keys.
When using complexes key_cache or when you need to purge the cache of more than one page, you will miss the option of using wildcards.
Here, we support willcards in the URI:
Example of use:
Put an '*' at the end of your purge cache URL.
This will remove every cached page whose key cache starting with:
Be careful not passing any value for the values after the $uri, or put
it at the end of your cache key.
As in the other pull request, feel free to improve or suggest improvements 😉