It's not entirely clear how to use path wildcards.

The help text says:

Enter every new url on a single line. Example: node/[node:nid].
If you want to use wildcard flush, add |wildcard to the end of the line. Example: node/[node:nid]|wildcard

Questions:

  1. What wildcards are supported: supposedly asterisk (*) that matches everything (including slashes), other ones?
  2. Are aliases allowed as well? E.g. will I match content/type/path/16 by content/type/*
  3. If node or alias is provided, does the process expire its alias variants and the node itself?
  4. Can asterisks be just at the end, or anywhere? E.g. will I match content/type/path/16 by */type/* or even */type/*/*

Comments

kobee’s picture

+1

How the wildcard works?
I've tried many combination, but no success..

Also how to add all the paginated pages like this:
headlines?page=1
headlines?page=2
headlines?page=3, etc...

Thanks.

spleshka’s picture

@Vacilando,

About using wildcards - please, pay your attencion at the function https://api.drupal.org/api/drupal/includes!cache.inc/function/cache_clea.... The third param is a wildcard.

1. Wildcard can be used only at the end of a cache id. Example: node* or node/list?page=*.
2. Yes, they should works as well.
3. Currently if aliases are enabled that means that only aliased pages will be flushes. This coded like that because with aliases always used globalredirect or redirect module that provides 301 redirect to the page with alias. If you want other behavior here you may create a feature request, or just code a few lines of code yourself.
4. As I answered above, only at the end.

@kobee,

See the information above.

kobee’s picture

Thanks for your answer, but it doesn't seems to work..

1/ I've tried:

headlines
headlines*
headlines|wildcard
schedule
schedule/2013-08-2*
schedule/2013-08-2|wildcard

But only the "headlines" and "schedule" are flushed.
Not "schedule/2013-08-25" neither "headlines?page=1" etc....

Is it a bug in the "Cache Expiration" module?

2/ Also if the wildcard is "*" , why the help says "Example: node/[node:nid]|wildcard" and not "Example: node/*" like everywhere in Drupal (in Boost page, or Display block rule for example..)?

3/ I'm on Nginx with perusio config, but WHY we need to flush the pages instead of using the expires headers like in Apache?

4/ I tried a cron command rm -rf /cache/normal/* but it just crash as their is too much pages.

spleshka’s picture

@kobee,

1. Yeah, you should use |wildcard instead of * in the UI. Sorry for the wrong example. I mean that this should work:

headlines|wildcard
schedule/2013-08-2|wildcard

Use debug output to get info about flushed pages.

2. See above

3. I suppose that you are using Boost. In your case it is possible to show expire header. But Cache Expiration module provides more common functionality. More over, if file was deleted phisically from the file system, Drupal will be force to generate a new one.

4. Delete them manually.

kobee’s picture

@Spleshka

1/ I used it but still not work.
How can help the debug output?

URL: http://site.com/schedule
Wildcard: false
Expired object: node
--------
URL: http://site.com/schedule/2013-08-2
Wildcard: true
Expired object: node
--------

2/ Why not changing the module, to keep consistency over all the Drupal interface (using *)?

3/ You're right, I'm using Boost. But the Perusio config doesn't work like normal apache rules, and the expires files won't refresh. So I HAVE to use Cache Expiration module to delete physically the files in order to force the refresh.

4/ I've tried also, but doesn't help. It's too big. So I've renamed my cache directory with "mv" command.. But it's not the solution ;-)

vacilando’s picture

@Spleshka, thanks for your clear answers!

I have to admit the help text at admin/structure/types/manage/article fooled me. I guess the reasons were:

  1. The non-standard wildcard
  2. The fact it speaks only about node/nid paths and there is no mention of aliases
  3. The fact that it does not explain that this is not a regexp or other fancy matching -- just a possibility of indicating ANY end of the given path.

In fact what I had used was: my/path/*|wildcard

I suggest to change the textarea help text lines from:

Enter every new url on a single line. Example: node/[node:nid].
If you want to use wildcard flush, add |wildcard to the end of the line. Example: node/[node:nid]|wildcard

to:

Enter each relative URL on a single line. It can be the node path or an alias. Examples: node/[node:nid] or my/path
It has to be the final URL, not a redirect or alias (use the Global Redirect and Redirect modules).
If you want to match a path with any ending (see https://api.drupal.org/api/drupal/includes%21cache.inc/function/cache_cl... for details), add "|wildcard" to the end of the line. Example: my/path|wildcard will match my/path, but also my/path/one, my/path/two, etc.

The API URL there would be a link under a text label.
The last line (about tokens) would remain intact.

If you agree and so wish, I can provide it in a patch.

spleshka’s picture

@kobee,

1. As far as I know, Boost does not provide wildcard flushes.
2. To be honest, I don't remember why I did this. But I'm sure that there were some reasons :)
3. Even Perusio's config relies on cached file existance. So yes, you need to remove files to force drupal to generate them again.
4. Try to do it step-by-step, deleting each folder in a cache directory.

@Vacilano,

Sure, such patch makes sense!

vacilando’s picture

Category: support » task
Status: Active » Needs review
StatusFileSize
new8.87 KB

OK, here's a patch improving each help section that deals with wildcards.

spleshka’s picture

Status: Needs review » Fixed

Thanks! Commited/pushed to 7.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Added one more question.

richsky’s picture

Well as far as I tested "|wildcard", it doesn't work with boost.

spleshka’s picture

Probably this is a Boost issue? Wildcards support appeared only in the 7.x-2.x branch.

RAFA3L’s picture

With the module Context Mobile Detect doesn't work...

For example Context Mobile Detect generate this cid for cache:

http://localhost/testcache/test?page=1&device=1&device_type=blackberry

This is a cached page of a view and has been seen from my phone.

The desktop cached pages are cleared properly using test|wildcard, for example:

http://localhost/testcache/test
http://localhost/testcache/test?page=1
http://localhost/testcache/test?page=2
...

Same with any content using content|wildcard:

http://localhost/testcache/content/test1
http://localhost/testcache/content/test2
...

Maybe the problem is where the url have multiple arguments and ampersands

RAFA3L’s picture

Im sorry, the problem was because on desktop I was using http://localhost and in my mobile http://mydomain.noip.com

But the problem continue with the home page, I tried with < front >|wildcard but all the cached pages are cleared, and for example http://mydomain.noip.com/testcache/?device|wildcard doesn't work

I would like clear all the versions and I don't know what token use to make it to work when this have a query string.

beauregard’s picture

Issue summary: View changes

I am trying to use wildcards together with the boost module. As I understand, this does not work together, is this correct? Is this a problem of boost or a problem of the expiration module?

I have a view called "cars". This is a paged view plus the car-nodes are saved in cars/car1, cars/car2 etc.
So I would need a wildcard for the paged view "cards" as well for all pages within cars.
I tried this cars|wildcard, which did not work.

Beside that, would it not be correct to use the wildcard as follows:
cars|wildcard --> for all URLs such as carsmercedes, carsbmw, carsfiat etc
cars/|wildcard --> for all URLS within cards, e.g. cars/car1, cars/car2 etc

beauregard’s picture

Status: Closed (fixed) » Active

I set status=active, because I added a comment to this task, thinking it belongs here.
If not, let me know and I open a new task

drclaw’s picture

Indeed, Boost does not currently support wildcards in it's implementation of hook_expire_cache, however there is some work going on in the boost issue queue to get it there #1810936: Support wildcards in boost_expire_cache

beauregard’s picture

great, thanks for the info. I will check it out.

naero’s picture

Simply put — for wildcards use this:

|wildcard

For example, use:
some/path/to/a/wildcard/path|wildcard

Instead of:
some/path/to/a/wildcard/path*

garamani’s picture

With the latest patch here you can use wildcards in Boost.
You can use asterisk (*) with Rules module for "Clear URL(s) from the page cache." action and also in the Cache Expiration UI.

Note: |wildcard doesn't work with boost module.

beauregard’s picture

hm, this is not true. I am using boost and |wildcard with this patch since 3 weeks.

RAWDESK’s picture

Hi, i've been using both methods simultaneous now, but in either case i seem to have a conflict with Internationalisation module which creates sub paths for my cached pages.
Eg. example.com/catalog becomes example.com/nl/catalog and example.com/fr/catalog in my Boost cache folder.

Whenever i try to set up an expiration rule, whether it is via Rules or Boost Cache Expiration on specific content type (in my case Product), the setted paths to clear are only partially performed.
More specific, only the pages behind the nl/ paths are cleared.

My Rules 'Clear URL(s) from the page cache' action values :
catalog
nl/catalog
fr/catalog
cataloog/*
nl/cataloog/*
fr/cataloog/*
cataloog/|wildcard
nl/cataloog/|wildcard
fr/cataloog/|wildcard
cache/normal/castabo.be/cataloog/*
cache/normal/castabo.be/fr/cataloog/*
cache/normal/castabo.be/nl/cataloog/*

My Product content type cache expiration entered custom URLs on node insert/update/delete :

shop
catalog
cataloog|wildcard
nl/cataloog|wildcard
fr/cataloog|wildcard
cataloog/|wildcard
nl/cataloog/|wildcard
fr/cataloog/|wildcard

As you can see, i am using the wildcard in several ways but only partial clearing is performed on the nl/ content.

nwom’s picture

@RAWDESK take a look at #2267305: Problem when clearing the cache of nodes using entity translation. That patch may be what you're looking for.

nwom’s picture

After looking at the documentation and testing it on the site, I think I understand the usage of wildcards, but one question still remains. How do I go about adding a wildcard that includes all potential query parameters?

I have a page that has views exposed filters and Facet API searches. There's potentially an unlimited amount of combinations of query parameters that can appear in the URL. So specifying everything after the URL as a wildcard would be extremely beneficial and is something I sadly haven't quite solved yet.

Thanks in advanced for any help.

rahim123’s picture

Hi there, I'm not sure if it's a coding bug or a documentation problem, but I can't get wildcard expiration to work with Boost for my forum overview pages. I added the following wildcards:

forum|wildcard
forum*
forum/|wildcard
forum/*

But still, paths like forum/misc/whatever aren't expiring. If I specifically add forum/misc/whatever as a custom rule it does expire, so it's just a wildcard problem.

delacosta456’s picture

@sb56637 and for some people that has faced this situation like me.. i would like to share what i noticed (after try for many days).This are some directions that may help

Step1-- only forum|wildcard or blog|wildcardshould be added which mean's you list can looks like
forum|wildcard
blog|wildcard
node/1
node/5
.............

AND NOT containing 2 same "wildcards" intention at the same time like in #25

Step2-- Make sure you enable authcache_builtin_expire_v2 module and that /admin/config/system/expire on "Module status TAB" you choose External expiration and also enable Include base URL in expires

Step3-- NOTE that when you enable authcache_builtin_expire_v2 module , it's has dendency module : Authcache Enumerate (authcache_enum) . As soon as authcache_enum is enabled , if you where working with super user (default admin of drupal) account and at admin/config/system/authcache you enable "Allow caching for superuser (uid = 1)", please check drupal's status page where you will see a notification of CONFLICT asking you to disable/uncheck "Allow caching for superuser (uid = 1)". If you disable it logically this mean that caching will be exclued (IT WAS WHAT I NOTICE)..enable caching for role administrator at admin/config/system/authcache .. then ... (step4)...

Step4-- Create another drupal user, to which you assign the role of Administrator ... login to that new account , clear all your cache (rebuild registry if possible).. AND TEST PAGES NOW

Doing so was what helped me..