Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am using memcache module with the following configuration:
// the path to the memcache.inc file
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
// make MemCacheDrupal the default cache class
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_form'] = 'DrupalDatabaseCache';
// declare Memcached servers
$conf['memcache_servers'] = array(
'xxx.xxx.xxx.xxx:11211' => 'default',
'yyy.yyy.yyy.yyy:11211' => 'default'
);
My problem is that cache_page does not seem to flush on node save.
Here are the details of my tests:
- Use browser 1 to display node/1 as an anonymous user
- Use browser 2 to edit node/1 with an authorized account & save the changes => the new version of node 1 is visible
- Refresh the page on browser 1 => the old version of node 1 is visible
- Wait until next cron call & refresh the page on browser 1 => the new version of node 1 is visible
I checked the code of the clear() function and when I replace (memcache.inc line 163):
$this->variable_set('cache_content_flush_' . $this->bin, $this->cache_content_flush);
by:
variable_set('cache_content_flush_' . $this->bin, $this->cache_content_flush);
cache_page is flushed after the update of the node.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1292208-memcache-variables-user-cache_bootstrap.patch | 713 bytes | brianV |
Comments
Comment #1
sdelbosc CreditAttribution: sdelbosc commentedI have investigated a bit on that point and it seems that the custom variable_set() function in the memcache.inc file should use cache_bootstrap bin instead of cache bin when dealing with variables cid.
Below is my suggestion:
Comment #2
BerdirUps, this is my mistake, I incorrectly ported this from D6.
Can you please provide a patch for this change?
Also, a test for this would be awesome. This could either be a direct API test, we'd however need to do the set/clear/load calls on separate page callbacks, in a test module. Or it could be a real use case test, which configures the site to use page caching and then creates, visits, updates and visits again (with another user) to verify that the clearing works.
But, a patch for just a bugfix would be enough as a start.
Comment #3
brianV CreditAttribution: brianV commentedAttached patch as requested to move this along...
Comment #4
BerdirLooks good.
Comment #5
catchThanks folks, committed and pushed.