I have a few panes on my user profiles that I want to clear the caches of for a specific user when that user's account is updated.

I thought I would be able to do this by appending 'uid:%user:uid' onto the cache key of each of these panes and setting a rule to 'Clear a specific cache cid' matching uid:[account:uid] + wildcards (e.g. %uid:[account:uid]% with 'use wildcard' ticked)

However, whilst I can see in the DB that the cache ids are being created fine if I use the context replacements as a suffix, the cache key is not generated properly (i.e. without the context key word or the unique id specific to the pane).

And when I use the replacement as a suffix, if I try to use the clear cid action with wildcards, nothing happens - nothing is cleared from the cache. I figure this is probably because I'm using the wrong character as a wildcard though, as this isn't documented. I tried * and %. What should I be using instead?

Comments

Thomas_S’s picture

... the $cid is treated as a substring to match rather than a complete ID. The match is a right hand match. If '*' is given as $cid, the bin $bin will be emptied...

It would be nice if we could use wildcards like in php.
I think you can't use wildcard sign in combination with the url. it runs with the left part of the url
example: [site:url]news/ clears all cid like SiteUrl/news/xyz
the wildcard * alone clears the complete bin.

(sorry for my bad english)

bradjones1’s picture

Title: Having difficultly getting wildcard clears to work » Wildcard cid clear needs to pass bool, not int, to cache_clear_all()
Status: Active » Needs review
StatusFileSize
new879 bytes

The problem described above (cid wildcard clearing not working) also plagued me, until I started doing some basic debugging. It turns out when I explicitly cast the "boolean" in the rules configuration (which actually comes in as an integer) to a bool type, it works as expected. This patch also includes a quick fix to the doxygen comment for this function.

bradjones1’s picture

Component: Miscellaneous » Code
Category: support » bug
StatusFileSize
new755 bytes

Same patch as above but without the errant extra newline at the end of the file. Also tagging as code bug.

szantog’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Patch #4 correct. Marked as major, because without this the module is unusable with memcache.

fabsor’s picture

Status: Reviewed & tested by the community » Fixed

Commited. Thanks!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

oop