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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | cookie_aware_page_cache-clear_cache--2730183-3.patch | 1.08 KB | luksak |
| #2 | cookie_aware_page_cache-clear_cache--2730183-2.patch | 552 bytes | progpapa |
| #2 | cookie_aware_page_cache-clear_cache--2730183-1.patch | 710 bytes | progpapa |
Comments
Comment #2
progpapa commentedComment #3
progpapa commentedSetting this to needs review...
I'm not using this module with memcache, but chances are it has the same issue with memcache.
Comment #4
luksakRerolling as one unified patch.