Thanks for the module, works great with Context Breakpoints. However I seem to be having issues with clearing the cache.

Reproducing the bugs is simple:

1. Cache is not updated after a node is edited.
- set up the module
- view a page with anonymous user, so that an entry to cache_page is inserted
- edit the page with admin and save
- view the page as anonymous again, the changes won't show up

2. Unable to flush cache.
- set up the module
- view a page with anonymous user, so that an entry to cache_page is inserted
- edit the page with admin and save
- go to /admin/config/development/performance and clear the cache
- view the page as anonymous again, the changes won't show up

Reason:
When clearing the cache CookieAwarePageCache::clear() is called with $cid = NULL or $nid = '*'.
After the prepare_cid call:
$cid = 'COOKIENAME:COOKIEVALUES|'
or
$cid = 'COOKIENAME:COOKIEVALUES|*'
then the parent method is called. In the parent method this part:
if (empty($cid)) {
or this part:
if ($cid == '*') {
is skipped since $cid was changed in prepare_cid and this is used:
->condition('cid', $cid)
or this:
->condition('cid', db_like($cid) . '%', 'LIKE')
which won't delete anything as no cid is 'COOKIENAME:COOKIEVALUES|' and no cid begins with 'COOKIENAME:COOKIEVALUES|*'

Solution:
There are probably many ways to solve this. The attached patch-1 checks if '*' or NULL was passed to prepare_cid, if yes, it is returned as is. The other patch tries to solve this in the clear method.

Comments

progpapa created an issue. See original summary.

progpapa’s picture

progpapa’s picture

Status: Active » Needs review

Setting this to needs review...

I'm not using this module with memcache, but chances are it has the same issue with memcache.

luksak’s picture

Rerolling as one unified patch.