backdrop-contrib / memcache

High performance integration with memcache.
2 stars 1 forks source link

Cache bins not being flushed on cache clear #3

Closed smaiorana closed 1 year ago

smaiorana commented 1 year ago

It appears several cache bins are not being properly flushed from Memcache on a cache clear. This includes the bootstrap bin, for example. The problem can be replicated easily by adding hook_init() to a module that doesn't already implement the hook, then attempting to trigger the new hook after a cache clear. The bootstrap bin never actually gets cleared, so the hook will never fire.

It appears this is happening because the cache flush timestamp is being are stored with a state name of flush but accessed with a state name of flush_timestamp.

This is from the flush() method:

    $this->flush_timestamp = REQUEST_TIME;
    $this->cacheStateSet('flush', $this->bin, $this->flush_timestamp);

This is from the reloadVariables() method:

    $this->flush_timestamp = $this->cacheStateGet('flush_timestamp', $this->bin, 0);

Changing state name instances of flush to flush_timestamp seems to fix the issue. I am going to submit a PR to address this.

smaiorana commented 1 year ago

@quicksketch Not sure who's maintaining this module, but I noticed you've done the conversion from Drupal so I'm making you aware of the issue.

quicksketch commented 1 year ago

Thanks @smaiorana! I had encountered this problem with the bootstrap bin in particular being unreliable. I'll make a new release right away to include this fix.

I never could get Memcache to be reliable in Backdrop, perhaps this will be the fix that's needed?

The Drupal 7 version had a very weird manipulation of the variables table to store the wildcard cache clear timestamps; which made it so that the Memcache backend had a dependency on the database. I tried to remove the database dependency for the Backdrop version, but it hasn't been reliable. Please let me know your experience!

smaiorana commented 3 weeks ago

Hi @quicksketch. We've been running this fix for over a year on multiple sites without issue. From our end, it appears the fix seems to resolve all our major Memcache problems.

Just a few weeks ago, we restructured some of our Backdrop sites and found out that we accidentally reverted to using 1.x-1.8.0-beta2 of this module, as it is still the last official release listed on the Backdrop CMS website. This introduced some old Memcache issues all over again. Is it possible to set up 1.x-1.8.0-beta3 as the latest official release? It seems to me to fix a lot of the major Memcache issues.

quicksketch commented 2 weeks ago

@smaiorana Oh man, I'm sorry! I made a tag but not a release for beta3. I've created the release so it should now take precedence over beta2.